Go-libp2p v0.28.0 released

Hey all,

There is a new release of go-libp2p! Release v0.28.0 路 libp2p/go-libp2p 路 GitHub

:flashlight: Highlights

Smart Dialing

This release introduces smart dialing logic. Currently, libp2p dials all addresses of a remote peer in parallel, and
aborts all outstanding dials as soon as the first one succeeds.
Dialing many addresses in parallel creates a lot of churn on the client side, and unnecessary load on the network and
on the server side, and is heavily discouraged by the networking community (see RFC 8305 for example).

When connecting to a peer we first determine the order to dial its addresses. This ranking logic considers a number of corner cases
described in detail in the documentation of the swarm package (swarm.DefaultDialRanker).
At a high level, this is what happens:

  • If a peer offers a WebTransport and a QUIC address (on the same IP:port), the QUIC address is preferred.
  • If a peer has a QUIC and a TCP address, the QUIC address is dialed first. Only if the connection attempt doesn鈥檛 succeed within 250ms, a TCP connection is started.

Our measurements on the IPFS network show that for >90% of established libp2p connections, the first connection attempt succeeds,
leading a dramatic decrease in the number of aborted connection attempts.

We also added new metrics to the swarm Grafana dashboard, showing:

  • The number of connection attempts it took to establish a connection
  • The delay introduced by the ranking logic

This feature should be safe to enable for nodes running in data centers and for most nodes in home networks.
However, there are some (mostly home and corporate networks) that block all UDP traffic. If enabled, the current implementation
of the smart dialing logic will lead to a regression, since it preferes QUIC addresses over TCP addresses. Nodes would still be
able to connect, but connection establishment of the TCP connection would be delayed by 250ms.

In a future release (see #1605 for details), we will introduce a feature called blackhole detection. By observing the outcome of
QUIC connection attempts, we can determine if UDP traffic is blocked (namely, if all QUIC connection attempts fail), and stop
dialing QUIC in this case altogether. Once this detection logic is in place, smart dialing will be enabled by default.

More Metrics!

Since the last release, we鈥檝e added metrics for:


  • #2251: Infer public WebTransport address from quic-v1 addresses if both transports are using the same port for both quic-v1 and WebTransport addresses.
  • #2271: Only add certificate hashes to WebTransport mulitaddress if listening on WebTransport

Housekeeping updates

  • Identify
    • #2303: Don鈥檛 send default protocol version
    • Prevent polluting PeerStore with local addrs
      • #2325: Don鈥檛 save signed peer records
      • #2300: Filter received addresses based on the node鈥檚 remote address
  • WebSocket
    • #2280: Reverted back to the Gorilla library for WebSocket
  • NAT
    • #2248: Move NAT mapping logic out of the host

:lady_beetle: Bugfixes