Don't automatically add STUN servers if nodeIP set (#1023)

It's my understanding that the nodeIP config can be set to ensure that a
specific IP is provided for the host candidate. The code being changed
here was added as a convenience so that:
| By giving it STUN servers, it should be
| connectable even without passing in --node-ip explicitly

We'd prefer to be able to specify a nodeIP and then as a side effect
have a STUN server added.
This commit is contained in:
maxb
2022-09-20 23:43:07 -07:00
committed by GitHub
parent 99cb021e85
commit eabecb99ac

View File

@@ -189,10 +189,11 @@ func NewWebRTCConfig(conf *config.Config, externalIP string) (*WebRTCConfig, err
if rtcConf.UseICELite {
s.SetLite(true)
} else if !rtcConf.UseExternalIP {
} else if rtcConf.NodeIP == "" && !rtcConf.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
// Do not automatically add STUN servers if nodeIP is set
if len(rtcConf.STUNServers) > 0 {
c.ICEServers = []webrtc.ICEServer{iceServerForStunServers(rtcConf.STUNServers)}
} else {