Do not pass STUN servers when using ICE Lite (#634)

This commit is contained in:
David Zhao
2022-04-20 00:29:57 -07:00
committed by GitHub
parent b821a0997d
commit 1cfc483d8f
+9 -10
View File
@@ -178,6 +178,15 @@ func NewWebRTCConfig(conf *config.Config, externalIP string) (*WebRTCConfig, err
if rtcConf.UseICELite {
s.SetLite(true)
} else if !conf.RTC.UseExternalIP {
// use STUN servers for server to support NAT
// when deployed in production, we expect UseExternalIP to be used, and ports accessible
// this is not compatible with ICE Lite
if len(conf.RTC.STUNServers) > 0 {
c.ICEServers = []webrtc.ICEServer{iceServerForStunServers(conf.RTC.STUNServers)}
} else {
c.ICEServers = []webrtc.ICEServer{iceServerForStunServers(config.DefaultStunServers)}
}
}
if len(rtcConf.Interfaces.Includes) != 0 || len(rtcConf.Interfaces.Excludes) != 0 {
@@ -206,16 +215,6 @@ func NewWebRTCConfig(conf *config.Config, externalIP string) (*WebRTCConfig, err
})
}
// use STUN servers for server to support NAT
// when deployed in production, we expect UseExternalIP to be used, and ports accessible
if !conf.RTC.UseExternalIP {
if len(conf.RTC.STUNServers) > 0 {
c.ICEServers = []webrtc.ICEServer{iceServerForStunServers(conf.RTC.STUNServers)}
} else {
c.ICEServers = []webrtc.ICEServer{iceServerForStunServers(config.DefaultStunServers)}
}
}
return &WebRTCConfig{
Configuration: c,
SettingEngine: s,