mirror of
https://gitlab.crans.org/nounous/ghostream.git
synced 2025-06-27 19:12:07 +02:00
Fix #7: make each module optional
This commit is contained in:
@ -19,6 +19,7 @@ var (
|
||||
|
||||
// Options holds web package configuration
|
||||
type Options struct {
|
||||
Enabled bool
|
||||
ListenAddress string
|
||||
MaxClients int
|
||||
}
|
||||
@ -53,6 +54,11 @@ func GetNumberConnectedSessions(streamID string) int {
|
||||
|
||||
// Serve SRT server
|
||||
func Serve(cfg *Options, authBackend auth.Backend, forwardingChannel, webrtcChannel chan Packet) {
|
||||
if !cfg.Enabled {
|
||||
// SRT is not enabled, ignore
|
||||
return
|
||||
}
|
||||
|
||||
// Start SRT in listening mode
|
||||
log.Printf("SRT server listening on %s", cfg.ListenAddress)
|
||||
host, port := splitHostPort(cfg.ListenAddress)
|
||||
|
@ -13,9 +13,9 @@ import (
|
||||
|
||||
// Options holds web package configuration
|
||||
type Options struct {
|
||||
MinPortUDP uint16
|
||||
MaxPortUDP uint16
|
||||
|
||||
Enabled bool
|
||||
MinPortUDP uint16
|
||||
MaxPortUDP uint16
|
||||
STUNServers []string
|
||||
}
|
||||
|
||||
@ -179,6 +179,11 @@ func Serve(remoteSdpChan chan struct {
|
||||
StreamID string
|
||||
RemoteDescription webrtc.SessionDescription
|
||||
}, localSdpChan chan webrtc.SessionDescription, inputChannel chan srt.Packet, cfg *Options) {
|
||||
if !cfg.Enabled {
|
||||
// SRT is not enabled, ignore
|
||||
return
|
||||
}
|
||||
|
||||
log.Printf("WebRTC server using UDP from port %d to %d", cfg.MinPortUDP, cfg.MaxPortUDP)
|
||||
|
||||
// Allocate memory
|
||||
|
Reference in New Issue
Block a user