Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContentInfoPacket ¶
func ContentInfoPacket(c []ConfigItem) packets.BasePacket[[]ConfigItem]
func ContentPortPacket ¶
func ContentPortPacket(port string) packets.BasePacket[string]
func Pong ¶
func Pong() packets.BasePacket[string]
func ValidateConfig ¶
Types ¶
type Config ¶
type Config struct {
Content []ConfigItem `json:"content"`
Throughput uint `json:"throughput"`
}
type Server ¶
type Server struct {
// Address in which the server listen for tcp connections.
Address netip.AddrPort
// represents the server properties and what content it has available.
Config Config
// tcp listener on the Address
TCPHandler handlers.TCPConn
// contains the addresses where I'm streaming to and what content is being streamed
ConnectionPool streamer.StreamingPool
// default streamer port, incremented depending on the number of streamers
AccessPort int
}
func New ¶
New creates a new server instance when passed its operating address and its configuration file path.
func (*Server) OnContent ¶
OnContent handles the request 'REQ' from the client. First the server responds via TCP (conn net.Conn) with the port where the content will be streamed on. Once the client answers with an 'OK' packet then we start the UDP stream by utilizing our streamer.Streamer struct.
func (*Server) OnPing ¶
OnPing function answers with Pong to Ping requests, used in metrics measurements by the clients, such as latency, jitter and packet loss.
func (*Server) OnStop ¶
OnStop function is responsible for stopping the transmission of a certain content. With every connection (alongside its streaming connections) being stored in a StreamingPool we can assure that we can stop its streaming goroutines.