mirror of
https://gitlab.crans.org/nounous/ghostream.git
synced 2024-12-23 00:22:19 +00:00
Comment Server SRT
This commit is contained in:
parent
98a798429c
commit
93ac5a7de1
@ -5,14 +5,14 @@ import "C"
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"gitlab.crans.org/nounous/ghostream/auth"
|
|
||||||
"gitlab.crans.org/nounous/ghostream/auth/bypass"
|
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/haivision/srtgo"
|
"github.com/haivision/srtgo"
|
||||||
|
"gitlab.crans.org/nounous/ghostream/auth"
|
||||||
|
"gitlab.crans.org/nounous/ghostream/auth/bypass"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Options holds web package configuration
|
// Options holds web package configuration
|
||||||
@ -51,19 +51,22 @@ func splitHostPort(hostport string) (string, uint16) {
|
|||||||
|
|
||||||
// Serve SRT server
|
// Serve SRT server
|
||||||
func Serve(cfg *Options, backend auth.Backend, forwarding chan Packet) {
|
func Serve(cfg *Options, backend auth.Backend, forwarding chan Packet) {
|
||||||
|
// If no authentification backend was provided, default to bypass
|
||||||
if backend == nil {
|
if backend == nil {
|
||||||
backend, _ = bypass.New()
|
backend, _ = bypass.New()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: should not use globals
|
||||||
authBackend = backend
|
authBackend = backend
|
||||||
forwardingChannel = forwarding
|
forwardingChannel = forwarding
|
||||||
|
|
||||||
options := make(map[string]string)
|
|
||||||
options["transtype"] = "file"
|
|
||||||
options["mode"] = "listener"
|
|
||||||
|
|
||||||
// Start SRT in listen mode
|
// Start SRT in listen mode
|
||||||
log.Printf("SRT server listening on %s", cfg.ListenAddress)
|
log.Printf("SRT server listening on %s", cfg.ListenAddress)
|
||||||
host, port := splitHostPort(cfg.ListenAddress)
|
host, port := splitHostPort(cfg.ListenAddress)
|
||||||
|
options := map[string]string{
|
||||||
|
"transtype": "file",
|
||||||
|
"mode": "listener",
|
||||||
|
}
|
||||||
sck := srtgo.NewSrtSocket(host, port, options)
|
sck := srtgo.NewSrtSocket(host, port, options)
|
||||||
if err := sck.Listen(cfg.MaxClients); err != nil {
|
if err := sck.Listen(cfg.MaxClients); err != nil {
|
||||||
log.Fatal("Unable to listen to SRT clients:", err)
|
log.Fatal("Unable to listen to SRT clients:", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user