https://github.com/libp2p/go-libp2p/pull/3364 migrated from zap to slog
but accidentally changed the log level for http.Server.ErrorLog from
implicit INFO to explicit ERROR. This caused client EOF and TLS handshake
errors to spam error logs and stdout in apps which log only ERROR by
default.
These http.Server errors (client EOFs, TLS handshake failures from clients
with naive TLS implementations, connection timeouts from clients that abort
early) are normal operational noise, not actual server errors. Using
LevelDebug:
- matches semantic meaning (similar to existing connection timeout logs)
- respects user's configured threshold (default ERROR filters them out)
- allows users to enable for debugging via log level configuration
Fixes https://github.com/ipfs/kubo/issues/11027
Fixes https://github.com/ipfs/kubo/issues/11033
This improves the reachability detection logic by introducing the concept of primary and secondary addresses. If we have a webtransport address which shares the IP and Port with a QUIC address, the WebTransport address will be considered secondary and the QUIC address will be considered primary.
If the Primary is reachable or unreachable, we require only one confirmation for the Secondary address. This speeds up address verification considerably. We also only refresh secondary addrs reachability once every 3 hours. For primary addresses this duration is 1 hour.
ConnAs works in a similar way to errors.As. It allows a user to cut
through the interface layers and extract a specific type of connection
if available.
This serves as a sort of escape hatch to allow users to leverage some
connection specific feature without having to support that feature for
all connections. Getting RTT information is one example.
It also allows us, within the library, to get specific types of
connections out of the interface box. This would have been useful in the
recent changes in tcpreuse. See
https://github.com/libp2p/go-libp2p/pull/3181 and
https://github.com/libp2p/go-libp2p/pull/3142.
Getting access to the underlying type can lead to hard to debug issues.
For example, if a user mutates connection state on the underlying type,
hooks that relied on only mutating that state from the wrapped
connection would never be called.
It is up to the user to ensure they are using this safely.
Multiple libp2p transports can share the same port (TCP, QUIC,
WebTransport, WebRTC-direct), causing duplicate AddMapping calls
for the same protocol/port combination. This fix adds deduplication
in NAT.AddMapping to prevent redundant NAT device operations and
reduce log spam.
Router restarts can cause UPnP/NAT-PMP services to change their
listening ports, leading to connection refused errors. This fix
implements automatic NAT rediscovery when consecutive connection
failures are detected, restoring all existing port mappings on
the new NAT instance.
See https://github.com/libp2p/go-libp2p/issues/3224#issuecomment-2866844723
for details on the router behavior that motivated this fix.