go-libp2p icon indicating copy to clipboard operation
go-libp2p copied to clipboard

fix: enable dctur when interface address is public

Open 2color opened this issue 1 year ago • 4 comments
trafficstars

What's in this PR

This change attempts to fix #2913.

In essence, it enables the dctur protocol, when a peer has a public IP (if it's bound to an interface with a public IP) without having to wait for an identify response (which would then make the public address visible via OwnObservedAddrs()).

Open questions

  • The OwnObservedAddrs() function in the identify service (which we rely on in the holepunch service) seems to not return observed addresses if they aren't dialable. Why is that?
    • Should be fixed by https://github.com/libp2p/go-libp2p/pull/2936

2color avatar Aug 21 '24 10:08 2color

I have some questions about the issue. Let's continue the discussion there. But one quick thing:

The OwnObservedAddrs() function in the identify service (which we rely on in the holepunch service) seems to not return observed addresses if they aren't dialable. Why is that?

What do you mean by dialable? By not dialable do you mean that the host will drop unsolicited incoming packets?

MarcoPolo avatar Aug 21 '24 22:08 MarcoPolo

By not dialable do you mean that the host will drop unsolicited incoming packets?

Exactly. It binds to a port on an interface with a public IP, however the firewall blocks incoming connections on that port.

2color avatar Aug 22 '24 09:08 2color

I've addressed your feedback @sukunrt.

2color avatar Aug 23 '24 09:08 2color

@MarcoPolo The change looks reasonable to me. If the node does have access to its own public address there's no reason to depend on identify for address discovery for hole punching.

sukunrt avatar Aug 27 '24 13:08 sukunrt