gowebrtcsfu

How to use more than one network to get ICE candidates with ion-sfu (pion)


I'm using an ion-sfu (and signaling) on a AWS instance running on its private network 10.0.0.160

This instance also have an elastic IP address 207.61.171.104

We access that SFU with a VPN that have access to the private network and also through a carrier gateway the elastic IP address.

To make it work on the elastic IP network, we add its IP in the setting:

nat1to1=["207.61.171.104"]

but when we do this the other network 10.0.0.x are no more able to establish a peer connection.

and when adding both to the list like this:

nat1to1 = ["10.0.0.160","207.61.171.104"]

then both are not working.

I'm wondering if it's possible to have both network peers to be able to connect to the sfu


Solution

  • This setting is exposing SetNAT1To1IPs from pion/webrtc.

    SetNAT1To1IPs comes with two modes. ICECandidateTypeHost which replaces all your private IPs with one of your choosing (what it is doing right now) or ICECandidateTypeSrflx which just appends an IP of your choosing.

    I think we should add a nat1to1_mode to ion-sfu. Where you can choose ICECandidateTypeHost or ICECandidateTypeSrflx. If you are interested would love to help you make that PR! You can try changing the code easily today here

    If you have more questions happy to chat here or on Pion Slack