libp2p / go-libp2p

libp2p implementation in Go
MIT License
6.09k stars 1.07k forks source link

NAT Traversal: Tell users if they are behind a symmetric NAT and document UPnP setup and port forwarding on Routers to help users #1017

Open aarshkshah1992 opened 4 years ago

aarshkshah1992 commented 4 years ago
Stebalien commented 4 years ago

This is done.

We should also document how to setup and validate the UPnP setup for users.

This can be enabled with the NATPortMap option. But I don't think this is enabled by default or well documented.

aarshkshah1992 commented 3 years ago

@jacobheun Let's create a nice document on everything address discovery, address advertisement and NAT traversal once we're done with Hole punching and publish the document to the world.

Even the UPnP documentation would go there..

FelipeRosa commented 3 years ago

Would love to help with this.

Just found out that NATPortMap option is deprecated (as stated here) in flavor of this.

Edit: Guess this is what was being referred: https://github.com/libp2p/go-libp2p/blob/master/options.go#L399

aarshkshah1992 commented 3 years ago

@FelipeRosa Thanks for reaching out. It would be great if you can create a document explaining how UPnP in libp2p works currently, how to enable it on home routers and how to do port forwarding on home routers. Does that sound good ?

FelipeRosa commented 3 years ago

@aarshkshah1992 sounds good.

Where should this document be created?

aarshkshah1992 commented 3 years ago

@FelipeRosa Feel free to create a Pull Request against https://github.com/libp2p/docs. It already has a NAT traversal page. You can add the content there.

If that sounds like too much work, you can simply add it all to a Github issue and I'll ensure it makes it's way to the libp2p docs site.

FelipeRosa commented 3 years ago

Not too much work at all! Really like the library.

aarshkshah1992 commented 3 years ago

Hey @FelipeRosa

How's it going ? Is there any way I can help you out with this ?

aarshkshah1992 commented 3 years ago

cc @vyzo @raulk

Will need help from Dev Onboarding team for this.

FelipeRosa commented 3 years ago

Hey @aarshkshah1992, sorry for the long delay. I've been a bit busy in the past couple of weeks (and probably will be until Monday).

I'm having some difficulties trying to wrap everything in my head. I've read part of the code for the NAT stuff.

What I'm trying to figure out is the "how UPnP works currently in libp2p". Currently I'm trying to find a way of testing how the NAT port map, etc. would work (because my router does not support it). I'm wondering if I could emulate that with containers or VMs in my computer. Do you have any suggestions?

Other than that, feel free to guide me if you think I'm steering in the wrong direction here too :).