Closed mxinden closed 1 year ago
//CC @dennis-tra as I am curious how the Golang implementation solves this. Just in case you know it already. Otherwise I will dive into the Golang code myself.
The go-client connects to PL's bootstrap nodes and blocks execution until it has learned its public addresses (this doesn't take long). There's this WaitForPublicAddr
function:
I've copied that bit from the go holepunch implementation.
For a hole punch to succeed, the local node needs to know its public (/external) address.
The current implementation depends on learning its external address through the relay node. In case the remote client initiates the DCUtR protocol before the relay node told us our public addresses the hole punch fails.
Consider connecting to some random node first, to learn ones public address before initiating the connection to the remote client and relay.
Related code in the rust-libp2p DCUtR client:
https://github.com/libp2p/rust-libp2p/blob/66c275520d8cf56152cce9a1c24bb4e2c42e0833/protocols/dcutr/examples/client.rs#L192-L223
//CC @elenaf9 I remember we talked about this, but I fail to recall what the result of that conversation was. Do you think the above might be an issue today?