1
0
mirror of https://gitlab.crans.org/nounous/ghostream.git synced 2024-12-23 00:22:19 +00:00

Limit WebRTC UDP ports

This commit is contained in:
Alexandre Iooss 2020-09-29 14:11:56 +02:00
parent 19a331b9e0
commit d46efaae3c
No known key found for this signature in database
GPG Key ID: 6C79278F3FCDCC02

View File

@ -45,7 +45,15 @@ func newPeerHandler(remoteSdp webrtc.SessionDescription) webrtc.SessionDescripti
} }
// Create a new PeerConnection // Create a new PeerConnection
api := webrtc.NewAPI(webrtc.WithMediaEngine(mediaEngine)) settingsEngine := webrtc.SettingEngine{}
if err := settingsEngine.SetEphemeralUDPPortRange(10000, 11000); err != nil {
log.Println("Failed to set min/max UDP ports", err)
return webrtc.SessionDescription{}
}
api := webrtc.NewAPI(
webrtc.WithMediaEngine(mediaEngine),
webrtc.WithSettingEngine(settingsEngine),
)
peerConnection, err := api.NewPeerConnection(webrtc.Configuration{ peerConnection, err := api.NewPeerConnection(webrtc.Configuration{
ICEServers: []webrtc.ICEServer{ ICEServers: []webrtc.ICEServer{
{ {