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

swarm: introduce address tiers to prioritize dials

Open marten-seemann opened this issue 3 years ago • 0 comments

Not all addresses are created equal, and we should be smarter when dialing:

  • We should prefer IPv6 over IPv4, implementing an Happy-Eyeballs-like mechanism as described in RFC 8305.
  • When given an IP multiaddr and a DNS multiaddr to dial (for any given transport), we should start dialing the IP address immediately, and start DNS resolution concurrently.
  • We should prefer QUIC over TCP. QUIC handshakes are fast (1 RTT), so giving QUIC a head start of a few hundred ms will allow us to not start the TCP handshake in the vast majority of cases.
  • We need to be able to learn from failed dials. Sometimes IPv6 is blackholed, or UDP. This blackholing will apply to address categories (it might work on the local network, but fail on the public internet), so the algorithm needs to be able to classify addresses.

Things to consider: it might be worth considering changing our transport interface, such that Dial is async and can be called with multiple addresses.

marten-seemann avatar Jun 20 '22 19:06 marten-seemann