Skip to main content

Module peer

Module peer 

Source
Expand description

The peer the caller wants to reach (PeerTarget) and the connection they get back (PeerConnection).

To the caller, crate::connect “just connects to a peer” — they describe the peer once and receive an mTLS-authenticated PeerConnection whose remote peer_id has been verified. Which traversal method got there is reported (observability) but never something the caller must choose or handle.

Structs§

PeerConnection
An established, mutually-authenticated, multiplexed connection to a peer.
PeerTarget
A description of the peer to connect to.

Functions§

is_ipv6_first
Whether addrs is ALREADY ordered IPv6-first (every IPv6 candidate at or before every IPv4 candidate) — i.e. sort_ipv6_first would be a no-op.
sort_ipv6_first
Sort a candidate list IPv6-first: every IPv6 address precedes every IPv4 address, preserving the relative order within each family (a stable sort). This is the single place the IPv6-first ordering rule is applied. Ordering is decided by the address FAMILY (SocketAddr::is_ipv6), never by inspecting the string form (a bracketed [v6]:port and an v4:port both contain ‘:’).