Implement external endpoint and NAT detection using the STUN protocol
madadam opened this issue · 0 comments
Knowing the external endpoint (that is, both IP and port) is necessary for manually adding peers in situations where all peer discovery mechanisms fail. Currently the app shows only the internal port which is often different from the external one. To improve this, we should implement a simple STUN client which performs the requests using the same socket we use for the sync protocol (same as we do with DHT). Using STUN is advantageous to using a custom protocol because we can take advantage of the existing network of public STUN servers. We can also easily deploy our own STUN servers as there are open source implementations available. We can use STUN for both external endpoint detection and for NAT detection.
Links:
- RFC 5389
- Rust STUN library
- TURN / STUN server available as deb package