-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
QUIC/WebTransport Transport sometimes uses the wrong socket to dial out. #2913
Comments
Do you know why your public ip doesn't show up as an observed address? Why don't other peers see this address, even if they can't dial you back? |
I don't know. I can debug more to check this. |
Update & InsightsI've been debugging this and have some useful insights:
LogsNote that I incrementally added some logs as I was going through this. The latest attempt was using the following branch Successful attempt to hole punchPeer A:
Peer B (Kubo behind NAT):
Unsuccessful attempt to hole punchPeer A
Peer B (Kubo behind NAT):
Unsuccessful attempt 2Peer A:
Peer B (Kubo behind NAT):
Unsuccessful attemp 3Peer A:
Peer B (Kubo behind NAT)
Successful attempt with different libp2p configIn this version, I changed the libp2p host config from: h, err := libp2p.New(libp2p.DefaultMuxers, libp2p.Muxer("/mplex/6.7.0", mplex.DefaultTransport), libp2p.EnableHolePunching())` to: ip4ListenAddr, _ := multiaddr.NewMultiaddr("/ip4/0.0.0.0/udp/0/quic-v1")
h, err := libp2p.New(libp2p.DefaultMuxers, libp2p.Muxer("/mplex/6.7.0", mplex.DefaultTransport), libp2p.EnableHolePunching(), libp2p.ListenAddrs(ip4ListenAddr)) Essentially only listening with QUIC on the ip4 interface. Peer A:
|
Ah, I think I know the issue here. I'll work on the fix now. |
The issue here is that the QUIC/WebTransport Transport don't have any logic to prefer their own socket when dialing out. So what happens is:
The holepunching failure is a downstream failure from this. |
@2color if you get a chance, could you verify the linked PR does indeed fix your issue? |
@MarcoPolo I tested #2936 and it was able to discover its own observed address consistently and reliably. I also added a bit of logging and confirmed that it was reusing the socket and port corresponding to the transport. |
* fix: allow punching undialable host public ip fixes #2913 * chore: use interface listen addrs to enable dctur * fix: filter public addresses * chore: remove unused function * chore: formatting --------- Co-authored-by: Daniel N <[email protected]>
* fix: allow punching undialable host public ip fixes #2913 * chore: use interface listen addrs to enable dctur * fix: filter public addresses * chore: remove unused function * chore: formatting --------- Co-authored-by: Daniel N <[email protected]>
* fix: allow punching undialable host public ip fixes #2913 * chore: use interface listen addrs to enable dctur * fix: filter public addresses * chore: remove unused function * chore: formatting --------- Co-authored-by: Daniel N <[email protected]>
Context
Given the following scenario:
h, err := libp2p.New(libp2p.DefaultMuxers, libp2p.EnableHolePunching())
h.Addrs()
contains public IPs:Problem
/libp2p/dcutr
protocol enabled."error": "failed to open hole-punching stream: failed to negotiate protocol: protocols not supported: [/libp2p/dcutr]"}
error (logged by Peer B).Source of the problem
Based on debugging with @sukunrt, it appears to be related to the following lines:
go-libp2p/p2p/protocol/holepunch/svc.go
Line 109 in 16a27ff
go-libp2p/p2p/protocol/holepunch/svc.go
Line 174 in 16a27ff
We were able to work around this problem and successfully hole punch by replacing
s.ids.OwnObservedAddrs()
withs.host.Addrs())
. This was a temporary measure, as we may just want to add the listen addrs to the observed addrs.Related issue
The text was updated successfully, but these errors were encountered: