[libnice] Force an external address (srflx) candidate?

Juan Navarro juan.navarro at gmx.es
Wed Oct 14 14:11:48 UTC 2020


I'd like to allow setting a static external IP address to my WebRTC SFU
server config, and have libnice generate a "fake" server-reflexive
candidate without needing STUN or TURN. Is this possible to do with libnice?

This is useful for cloud deployments where the server has a well known
address, to skip the need for STUN on the server and also minimize the
time needed for ICE. At the same time, any WebRTC peer would
transparently work by receiving the fake srflx candidate, thus knowing
where to connect with the server. This is an important one for me: not
needing to touch anything else about the signaling or the implementation
at the client.

To be honest I already have this feature working (see
but it is a VERY ugly hack, which modifies _all_ candidates to replace
their IP address with the external one specified in this setting. This
works, because remote peers receive then all those host candidates with
the correct IP, and they are able to connect with the server. But I'd
like to have a "cleaner" solution, if there is one for this scenario. So
I thought that a better thing to do would be to tell libnice to forge a
srflx candidate.

BTW, what are people doing for this? I think letting a server know of
its own external address is a pretty common thing (e.g. "external-ip"
setting in Coturn).

Thanks and regards,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/nice/attachments/20201014/ac0f224c/attachment.htm>

More information about the nice mailing list