diff --git a/README.md b/README.md index d38cd1b1..6f1467b9 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,7 @@ For n.eko room management software visit https://github.com/m1k1o/neko-rooms. - Added simple language picker. - Added `?usr=` that will prefill username. This allows creating auto-join links. - Added `?cast=1` that will hide all control and show only video. +- Support for password protected `NEKO_ICESERVERS` (by @mbattista). ### Bugs - Fixed minor gst pipeline bug. @@ -282,7 +283,7 @@ NEKO_ICELITE: - Use the ice lite protocol - e.g. false NEKO_ICESERVER: - - Describes a single STUN and TURN server that can be used by the ICEAgent to establish a connection with a peer (deprecated) + - Describes a single STUN and TURN server that can be used by the ICEAgent to establish a connection with a peer (simple usage for server without authentication) - e.g. 'stun:stun.l.google.com:19302' NEKO_ICESERVERS: - Describes multiple STUN and TURN server that can be used by the ICEAgent to establish a connection with a peer diff --git a/server/internal/types/config/webrtc.go b/server/internal/types/config/webrtc.go index 996bbd09..7b8607fa 100644 --- a/server/internal/types/config/webrtc.go +++ b/server/internal/types/config/webrtc.go @@ -50,15 +50,22 @@ func (WebRTC) Init(cmd *cobra.Command) error { } func (s *WebRTC) Set() { + s.NAT1To1IPs = viper.GetStringSlice("nat1to1") s.ICELite = viper.GetBool("icelite") - s.ICEServers = []webrtc.ICEServer{{URLs: viper.GetStringSlice("iceserver")}} - if viper.GetString("iceservers") != "" { - err := json.Unmarshal([]byte(viper.GetString("iceservers")), &s.ICEServers) + s.ICEServers = []webrtc.ICEServer{} + + iceServersJson := viper.GetString("iceservers") + if iceServersJson != "" { + err := json.Unmarshal([]byte(iceServersJson), &s.ICEServers) if err != nil { panic(err) } } - s.NAT1To1IPs = viper.GetStringSlice("nat1to1") + + iceServerSlice := viper.GetStringSlice("iceserver") + if len(iceServerSlice) > 0 { + s.ICEServers = append(s.ICEServers, webrtc.ICEServer{URLs: iceServerSlice}) + } if len(s.NAT1To1IPs) == 0 { ip, err := utils.GetIP()