js-libp2p
js-libp2p copied to clipboard
feat: add autonat support
Implements the autonat spec to give us confidence in our external addresses and to open the door to things like switching DHT server mode on automatically, hole punching, v2 circuit relay etc.
Depends on:
- [ ] https://github.com/libp2p/js-libp2p-interfaces/pull/269
Fixes #1005
Testing locally, I get different port numbers from every connection during identify.
E.g. I have uPNP hole punching which opens /ip4/${PUBLIC_IP}/tcp/4002 - the observedAddr reported by identify is like /ip4/${PUBLIC_IP}/tcp/61253, /ip4/${PUBLIC_IP}/tcp/61254 etc. We end up with a different observed address for every connection and we can't use autonat to confirm/delete them fast enough so the list grows and grows and grows.
We need to handle this better before merging. Either:
- Limit the number of unconfirmed, observed addresses we store
- Ignore identify observedAddrs
- Something else?
Okay, I managed to bring it up to speed with the current master branch. @achingbrain How do you test that locally and observe?