NAT Traversal

From Adam Colton
Jump to navigation Jump to search

Go Code https://golanglibs.com/dig_in/upnp

Theory

The techniques break down into two groups. Most solutions give the user a public facing IP and Port. Hole-punching (potentially) does not. It can assign a different port for each connection.

So we need these pieces of information:

  • Node ID
  • IP:Port
  • Direct Connect
  • STUN server
  • Router Type

STUN server and Router type are only important if Direct Connect is false. If both our router and their router is symmetric and we both don't have Direct Connect, no connection is possible.