libp2p / go-libp2p

libp2p implementation in Go
MIT License
5.83k stars 1.04k forks source link

webrtc: Figure out a way to discover webrtc-direct addresses #2592

Open sukunrt opened 9 months ago

sukunrt commented 9 months ago

Currently node doesn't dial out of the UDP packet conn that it is listening on for /webrtc-direct. Because of this it cannot discover its publicly dialable address.

We find our listen address by dialing out using reuseport and then checking the observed address on identify. In webrtc-direct we never do a reuseport and so there's no way to find our listening address unless we manage to do port mapping on the router. So address discovery won't work on EC2 machines which don't have access to public IP from within the instance or UPnP like port mapping system.

@mxinden how does rust-libp2p do this address discovery?

mxinden commented 9 months ago

rust-libp2p's /webrtc-direct implementation reuses the listen port for outgoing dials.

Related: currently rust-libp2p's /webrtc-direct implementation has a bug, where one can not dial without a previous listen. https://github.com/libp2p/rust-libp2p/issues/4071