Documentation
¶
Index ¶
- Constants
- Variables
- func Handler(conn net.Conn, va ...interface{})
- type Flooder
- type Node
- func (n *Node) AddRelay(contentName string, relay *Relay) error
- func (n *Node) IsPositive(requestId uuid.UUID) (string, bool)
- func (n *Node) IsStreaming(contentName string) bool
- func (n *Node) NextPort() uint64
- func (n *Node) OnDiscovery(incoming packets.Packet, conn net.Conn)
- func (n *Node) OnStream(incoming packets.Packet, conn net.Conn)
- func (n *Node) Run()
- func (n *Node) SetPositive(requestId uuid.UUID, source string)
- type Relay
- type RequestDb
Constants ¶
View Source
const ReadSize = 1024
Variables ¶
View Source
var ( Request = packets.BasePacket[string]{ Header: packets.PacketHeader{ Flag: bootstrap.GET, }, Payload: "", } )
Functions ¶
Types ¶
type Flooder ¶
func NewFlooder ¶
type Node ¶
type Node struct {
// information about what type of node I am, what are my neighbours
Self bootstrap.Node
// component responsible for flooding its neighbours with a packet
Flooder Flooder
// responsible for receiving tcp connections and handling them accordingly
TCPHandler handlers.TCPConn
// default address where the client listen to incoming requests
Address netip.AddrPort
// keeps track of handled requests
Requests *RequestDb
// relay pool, keeps track of receiving streams and who are we relaying them to
RelayPool map[string]*Relay
// positive, keeps track of received FOUND packets
Positive map[uuid.UUID]string
// each relay has a port
CurrentPort uint64
// contains filtered or unexported fields
}
func (*Node) IsStreaming ¶
IsStreaming checks whether the current node is streaming a certain content by its contentName.
type Relay ¶
type Relay struct {
// Name of the video that we are listening to from Origin.
ContentName string
// Address of which the video stream is coming from.
Origin string
// Slice containing the addresses (as *UDPAddr) to forward the bytes to.
Addresses []*net.UDPAddr // no longer needed as for Connections
// Default port for forwarding addresses.
Port string
Connections []*net.UDPConn
// contains filtered or unexported fields
}
func (*Relay) Add ¶
Add adds a new address into the Relay, this makes so that the bytes read from Loop are forwarder to address as well.
Click to show internal directories.
Click to hide internal directories.