js-libp2p icon indicating copy to clipboard operation
js-libp2p copied to clipboard

feat: add autonat support

Open achingbrain opened this issue 3 years ago • 1 comments

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

achingbrain avatar Jul 19 '22 11:07 achingbrain

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:

  1. Limit the number of unconfirmed, observed addresses we store
  2. Ignore identify observedAddrs
  3. Something else?

achingbrain avatar Jul 19 '22 11:07 achingbrain

Okay, I managed to bring it up to speed with the current master branch. @achingbrain How do you test that locally and observe?

mpetrunic avatar Feb 13 '23 15:02 mpetrunic