-
Notifications
You must be signed in to change notification settings - Fork 18
Cost more than two minutes to find NAT gateway in some Network structure #21
Comments
When you say Beyond that, this could be a DNS issue. Unfortunately, this issue is likely very specific to your network. We'll need more timing information to figure out where the problem lies. |
@Stebalien I do not doing anything else. Just get NAT and print external IP address. Code:
Console:
DNS is the same: What information do you need to collect? I am happy to help you debug. build code as nat application, runing at home:d@debian:~$ ./nat --type=libp2p 2019/11/12 14:00:44 NAT示例 2019/11/12 14:00:44 使用go-libp2p-nat 2019/11/12 14:00:49 已有NAT映射: [] 2019/11/12 14:00:49 NAT公网地址: 59.172.149.246:11266 d@debian:~$ ./nat --type=gateway 2019/11/12 14:01:07 NAT示例 2019/11/12 14:01:07 使用go-nat 2019/11/12 14:01:12 NAT网关公网IP: 59.172.149.246 2019/11/12 14:01:12 NAT映射端口: 60000 19941 d@debian:~$ ./nat --type= 2019/11/12 14:01:19 NAT示例 2019/11/12 14:01:19 使用go-nat 2019/11/12 14:01:19 NAT网关公网IP: 59.172.149.246 2019/11/12 14:01:19 NAT映射端口: 60000 52292 |
Looking at your code, you're only waiting for it to discovery the first gateway.
|
When I tested Supplemental NAT type information:
|
Could you try libp2p/go-nat#13? It looks like we weren't properly obeying timeouts.
Ah, sorry. I should have asked: how long does it take to read all the NATs off the channel until the channel closes?
So less than 2 seconds? I asked because this function does three things:
I'm trying to figure out what's taking so long.
We do. Closed channels return nil. Specifically: result := <-closedChan // result == nil
result, ok := <-closedChan // result == nil, ok == false |
Haven't heard back in 2.5 years. Closing this issue. |
I tested go-libp2p-nat and go-nat at the company and at home.
Company:
Network structure: PC > switch > router
No firewall.
go-libp2p-nat.DiscoverNAT(ctx) and go-nat.DiscoverGateway() cost more than 2 minutes.
go-nat.DiscoverNATs(ctx) cost about 2 seconds.
Home:
Network structure: PC(DMZ) > router
No firewall.
go-libp2p-nat.DiscoverNAT(ctx) and go-nat.DiscoverGateway() cost about 5 seconds.
go-nat.DiscoverNATs(ctx) cost less than 1 seconds.
Code: https://github.com/alx696/libp2p/blob/master/go-nat-example/main.go
The text was updated successfully, but these errors were encountered: