diff --git a/format/webrtcv3/adapter.go b/format/webrtcv3/adapter.go index 06269db..c93cbf1 100644 --- a/format/webrtcv3/adapter.go +++ b/format/webrtcv3/adapter.go @@ -43,6 +43,8 @@ type Options struct { ICEUsername string // ICECredential is an optional credential (i.e., password) for authenticating with the given ICEServers ICECredential string + // ICECandidates sets a list of external IP addresses of 1:1 + ICECandidates []string // PortMin is an optional minimum (inclusive) ephemeral UDP port range for the ICEServers connections PortMin uint16 // PortMin is an optional maximum (inclusive) ephemeral UDP port range for the ICEServers connections @@ -77,6 +79,10 @@ func (element *Muxer) NewPeerConnection(configuration webrtc.Configuration) (*we s.SetEphemeralUDPPortRange(element.Options.PortMin, element.Options.PortMax) log.Println("Set UDP ports to", element.Options.PortMin, "..", element.Options.PortMax) } + if len(element.Options.ICECandidates) > 0 { + s.SetNAT1To1IPs(element.Options.ICECandidates, webrtc.ICECandidateTypeHost) + log.Println("Set ICECandidates", element.Options.ICECandidates) + } api := webrtc.NewAPI(webrtc.WithMediaEngine(m), webrtc.WithInterceptorRegistry(i), webrtc.WithSettingEngine(s)) return api.NewPeerConnection(configuration) }