feat: add UPnP NAT manager (#810)

* feat: add uPnP nat manager

Adds a really basic nat manager that attempts to use UPnP to punch
a hole through your router for any IPV4 tcp addresses you have
configured.

Adds any configured addresses to the node's observed addresses list
and adds observed addresses to `libp2p.multiaddrs` so we exchange
them with peers when performing `identify` and people can dial you.

Adds configuration options under `config.nat`

Hole punching is async to not affect start up time.

Co-authored-by: Vasco Santos <vasco.santos@moxy.studio>
This commit is contained in:
Alex Potsides
2021-01-27 13:55:26 +00:00
committed by GitHub
parent b5c9e48b68
commit 0a6bc0d101
16 changed files with 742 additions and 22 deletions

View File

@ -51,7 +51,7 @@ describe('Dialing (direct, TCP)', () => {
peerStore = new PeerStore({ peerId: remotePeerId })
remoteTM = new TransportManager({
libp2p: {
addressManager: new AddressManager({ listen: [listenAddr] }),
addressManager: new AddressManager(remotePeerId, { listen: [listenAddr] }),
peerId: remotePeerId,
peerStore
},