1
0
mirror of https://gitlab.crans.org/nounous/ghostream.git synced 2025-06-29 11:00:55 +02:00

Display SRT url on web page

This commit is contained in:
Alexandre Iooss
2020-10-04 11:45:16 +02:00
parent 3f5d317250
commit 5cdb5282ef
4 changed files with 16 additions and 6 deletions

View File

@ -4,6 +4,7 @@ package main
import (
"log"
"net"
"strings"
"github.com/spf13/viper"
@ -66,6 +67,14 @@ func loadConfiguration() {
// Copy STUN configuration to clients
viper.Set("Web.STUNServers", viper.Get("WebRTC.STUNServers"))
// Copy SRT server port to display it on web page
hostport := viper.GetString("Srt.ListenAddress")
_, srtPort, err := net.SplitHostPort(hostport)
if err != nil {
log.Fatalf("Failed to split host and port from %s", hostport)
}
viper.Set("Web.SRTServerPort", srtPort)
}
func main() {