Giter Site home page Giter Site logo

Comments (5)

cnderrauber avatar cnderrauber commented on July 17, 2024

If you have multiple interfaces to listen on, don't use a single external address to call SetNAT1To1IPs, which override your candidates. And it will cause another port conflict issue like this:

You have interface IA, IB, both mapping to IC. Two clients 1 and 2.
client 1 get server candidates IC:34567(from IA), IC:45678(from IB)
client 2 get server candidates IC:34567(from IB), IC:45678(from IA), because when pion allocateing port for client2, IA:45678 and IB:34567 are free to use, but when they mapped to IC, will conflict with client1's address and failed to connect.

The better way is (what we are doing now):

  1. enumerate the interfaces you are going to use. (IA, IB, IC)
  2. resolve external address for each interface (by public stun server) (IA -> EA, IB ->EB, IC -> EA)
  3. SetNAT1To1IPs with mapping pair instead of a single external address, and if you have two interface resolved to same public address, only map the first one and keep the other one map to itself. SetNAT1To1IPs([]string{EA/IA, EB/IB, IC/IC})

from ice.

streamer45 avatar streamer45 commented on July 17, 2024

Very interesting, I wasn't aware SetNAT1To1IPs supported more advanced parameters like pairs but now it makes all sense. I'll definitely give this a try, thank you!

from ice.

streamer45 avatar streamer45 commented on July 17, 2024

@cnderrauber That "trick" seems to work nicely. Out of curiosity, would it be acceptable to map the first interface (e.g. IA) as EA/IA and any subsequent interface to itself (IB/IB, IC/IC, and so on)? I am thinking of a scenario where resolving the external address is not possible (e.g. blocked outgoing ports) and the user will explicitly provide a single public IP instead.

from ice.

cnderrauber avatar cnderrauber commented on July 17, 2024

@streamer45 It will definitely work if your IA can be accessed from EA by public clients.

from ice.

streamer45 avatar streamer45 commented on July 17, 2024

Very well, this was extremely helpful, thank you again. We can close this one :)

from ice.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.