Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix AutoNAT service for private network #6251

Merged
merged 1 commit into from
Apr 25, 2019

Conversation

requilence
Copy link
Contributor

fixing #6250

Copy link
Member

@magik6k magik6k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(needs rebase)

Thanks for catching this!

1 nit, invoking P2PPNet manually seems fine. We could try to re-use the protector from the main host, but it's probably not worth it.

core/node/libp2p.go Outdated Show resolved Hide resolved
@requilence requilence force-pushed the autonat-pnet branch 3 times, most recently from 1a82cbb to 12f6bee Compare April 25, 2019 12:01
License: MIT
Signed-off-by: Roman Khafizianov <requilence@gmail.com>
@requilence
Copy link
Contributor Author

requilence commented Apr 25, 2019

We could try to re-use the protector from the main host, but it's probably not worth it

I was able to do this way in 0.4.20, but with current fx refactoring, I'm not sure how to pass it

Copy link
Member

@magik6k magik6k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Thanks

but with current fx refactoring, I'm not sure how to pass it

You'd need to return ipnet.Protector from the PNet function, and then import that in AutoNATService as an argument, and check if it's set.. Probably not worth it, plus I'll be giving at least one more cleaning pass to these areas of code soon.

@magik6k magik6k added the RFM label Apr 25, 2019
@Stebalien Stebalien merged commit a3501a4 into ipfs:master Apr 25, 2019
@aloknerurkar
Copy link

aloknerurkar commented Mar 31, 2020

Does this functionality work as expected? I updated to the latest version of IPFS and I am not able to get the node to do the NAT traversal when I am using a swarm key.

LIBP2P_FORCE_PNET=1 ipfs daemon                                                            
Initializing daemon...                                                                                                                         
go-ipfs version: 0.4.23-6ce9a35                                                                                                                
Repo version: 7                                                                                                                                
System version: amd64/darwin                                                                                                                   
Golang version: go1.13.8                                                                                                                       
Swarm is limited to private network of peers with the swarm key                                                                                
Swarm key fingerprint: d4574a64137198e7c6c8366f77e37e46                                                                                        
Swarm listening on /ip4/127.0.0.1/tcp/4001                                                                                                     
Swarm listening on /ip4/192.168.0.98/tcp/4001                                                                                                  
Swarm listening on /ip6/::1/tcp/4001                                                                                                           
Swarm listening on /ip6/fd01::18eb:9ca2:8968:d339/tcp/4001                                                                                     
Swarm listening on /ip6/fd01::39c2:943c:4774:db16/tcp/4001                                                                                     
Swarm listening on /p2p-circuit                                                                                                                
Swarm announcing /ip4/127.0.0.1/tcp/4001
Swarm announcing /ip4/192.168.0.98/tcp/4001
Swarm announcing /ip6/::1/tcp/4001
Swarm announcing /ip6/fd01::18eb:9ca2:8968:d339/tcp/4001
Swarm announcing /ip6/fd01::39c2:943c:4774:db16/tcp/4001
API server listening on /ip4/127.0.0.1/tcp/5001
WebUI: http://127.0.0.1:5001/webui
Gateway (readonly) server listening on /ip4/127.0.0.1/tcp/8080
Daemon is ready

Whereas when I don't use swarm key, I see the NAT traversal happening.

ipfs daemon         
Initializing daemon...
go-ipfs version: 0.4.23-6ce9a35
Repo version: 7
System version: amd64/darwin
Golang version: go1.13.8
Swarm listening on /ip4/127.0.0.1/tcp/4001
Swarm listening on /ip4/192.168.0.98/tcp/4001
Swarm listening on /ip6/::1/tcp/4001
Swarm listening on /ip6/fd01::18eb:9ca2:8968:d339/tcp/4001
Swarm listening on /ip6/fd01::39c2:943c:4774:db16/tcp/4001
Swarm listening on /p2p-circuit
Swarm announcing /ip4/106.51.29.204/tcp/21683 => The public IP announced
Swarm announcing /ip4/127.0.0.1/tcp/4001
Swarm announcing /ip4/192.168.0.98/tcp/4001
Swarm announcing /ip6/::1/tcp/4001
Swarm announcing /ip6/fd01::18eb:9ca2:8968:d339/tcp/4001
Swarm announcing /ip6/fd01::39c2:943c:4774:db16/tcp/4001
API server listening on /ip4/127.0.0.1/tcp/5001
WebUI: http://127.0.0.1:5001/webui
Gateway (readonly) server listening on /ip4/127.0.0.1/tcp/8080
Daemon is ready

@Stebalien
Copy link
Member

Please file a new bug report and include your config (minus your private key). Something looks fishy.

@aloknerurkar
Copy link

Filed #7067
Let me know if you need any other information.

I see the autonat-svc used by ipfs is deprecated. Libp2p has a new autonat package that it's using.

@willscott
Copy link
Contributor

github.com/libp2p/go-libp2p-autonat-svc/ is now incorporated into github.com/libp2p/go-libp2p-autonat/ which acts as both the service allowing nodes to determine their nat status, and the process by which nodes go about querying other nodes to learn their status.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants