From 93ac5a7de1ebdaa7d57338f9bc973a3840e26b1b Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Sat, 3 Oct 2020 17:42:38 +0200 Subject: [PATCH] Comment Server SRT --- stream/srt/srt.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/stream/srt/srt.go b/stream/srt/srt.go index 2a7e570..51af44a 100644 --- a/stream/srt/srt.go +++ b/stream/srt/srt.go @@ -5,14 +5,14 @@ import "C" import ( "fmt" - "gitlab.crans.org/nounous/ghostream/auth" - "gitlab.crans.org/nounous/ghostream/auth/bypass" "log" "net" "strconv" "strings" "github.com/haivision/srtgo" + "gitlab.crans.org/nounous/ghostream/auth" + "gitlab.crans.org/nounous/ghostream/auth/bypass" ) // Options holds web package configuration @@ -51,19 +51,22 @@ func splitHostPort(hostport string) (string, uint16) { // Serve SRT server func Serve(cfg *Options, backend auth.Backend, forwarding chan Packet) { + // If no authentification backend was provided, default to bypass if backend == nil { backend, _ = bypass.New() } + + // FIXME: should not use globals authBackend = backend forwardingChannel = forwarding - options := make(map[string]string) - options["transtype"] = "file" - options["mode"] = "listener" - // Start SRT in listen mode log.Printf("SRT server listening on %s", cfg.ListenAddress) host, port := splitHostPort(cfg.ListenAddress) + options := map[string]string{ + "transtype": "file", + "mode": "listener", + } sck := srtgo.NewSrtSocket(host, port, options) if err := sck.Listen(cfg.MaxClients); err != nil { log.Fatal("Unable to listen to SRT clients:", err)