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

UDP Holepunching with QUICK for more compatiable NAT traversal #2058

Closed
TheRook opened this issue Feb 5, 2023 · 1 comment
Closed

UDP Holepunching with QUICK for more compatiable NAT traversal #2058

TheRook opened this issue Feb 5, 2023 · 1 comment

Comments

@TheRook
Copy link

TheRook commented Feb 5, 2023

The hole punching documentation stays that DCUtR is being used with TCP:
https://docs.libp2p.io/concepts/nat/hole-punching/

The DCUtR documentation says that it works best with UDP and reasonably well with TCP:
https://github.com/libp2p/specs/blob/master/relay/DCUtR.md

The go-libp2p implementation is not considering the differences in how edge network routers may react to a TCP vs UDP hole-punch:

func (hp *holePuncher) DirectConnect(p peer.ID) error {
if err := hp.beginDirectConnect(p); err != nil {
return err
}
defer func() {
hp.activeMx.Lock()
delete(hp.active, p)
hp.activeMx.Unlock()
}()
return hp.directConnect(p)

Ideally - go-libp2p would try the most efficient method first, which is probably UPnP. If UPnP fails, then try a QUICK with a UDP holepunch to see if can be used to form connection. If this more efficient UDP method fails, then try the current TCP holepunch - if that fails then look for a relay... and if relays are failing then the client is likely being filtered by their ISP or government.

@p-shahi
Copy link
Member

p-shahi commented Feb 5, 2023

Hi, thanks for creating this issue but I will close it since it's better topic for the discussion forum: discuss.libp2p.io

Ideally - go-libp2p would try the most efficient UDP based holepunch - so maybe using QUICK with a UDP to see if that accepts connections - if it fails then try the current TCP holepunch - if that fails then look for a relay.

This is an improvement we've identified. See: #1785

Also, the Probe Lab team recently ran a hole punching measurement campaign and results will be published soon: https://discuss.libp2p.io/t/call-for-participation-nat-hole-punching-measurement-campaign/1690

@p-shahi p-shahi closed this as completed Feb 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants