1
0
mirror of https://gitlab.crans.org/nounous/ghostream.git synced 2025-06-27 07:58:50 +02:00

Make STUN server configurable

This commit is contained in:
Alexandre Iooss
2020-09-29 17:27:19 +02:00
parent 1c98754624
commit 95f4b81f01
6 changed files with 24 additions and 15 deletions

View File

@ -18,6 +18,8 @@ import (
type Options struct {
MinPortUDP uint16
MaxPortUDP uint16
STUNServers []string
}
// SessionDescription contains SDP data
@ -65,11 +67,7 @@ func newPeerHandler(remoteSdp webrtc.SessionDescription, cfg *Options) webrtc.Se
webrtc.WithSettingEngine(settingsEngine),
)
peerConnection, err := api.NewPeerConnection(webrtc.Configuration{
ICEServers: []webrtc.ICEServer{
{
URLs: []string{"stun:stun.l.google.com:19302"},
},
},
ICEServers: []webrtc.ICEServer{{URLs: cfg.STUNServers}},
})
if err != nil {
log.Println("Failed to initiate peer connection", err)