#[non_exhaustive]pub enum PeerPath {
Direct,
Relay {
url: Option<String>,
},
Unknown,
}Expand description
HOW a peer is reached (#64): a direct/hole-punched QUIC path, or through a relay.
rtt_ms is NOT a proxy for this — a fast relay beats a slow direct path — and iroh’s own
distinction was being dropped at the mcpmesh boundary. Three things depend on it: a truthful
locality claim (“this traffic never left the building”), honest disclosure that a relayed path
depends on third-party infrastructure, and diagnostics, since “slow” has a different cause and
fix in each case.
Only Direct supports a locality claim. Unknown means “we do not know”, NOT “private” —
rendering it as private is the one misuse that turns this field into a false privacy statement.
The daemon errs the same way: when a relay path is active it reports Relay even
if a direct path is live too, because overstating privacy is worse than understating it.
#[non_exhaustive]: iroh already has a third address kind (a custom transport) that could
warrant a variant, and adding one to a public enum later breaks every downstream exhaustive
match — the lesson #58 paid for.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Direct
A direct or hole-punched QUIC path: the bytes did not transit a relay.
Relay
Through a relay server. url is the relay in use when known.
Unknown
Not known: never probed, no selected path, or a transport mcpmesh does not model.
#[serde(other)] makes this the landing spot for a kind a client has never heard of. That
is what actually buys wire-additivity: #[non_exhaustive] only protects the Rust match,
and without this an older client hits unknown variant and fails to deserialize the WHOLE
PeerReachability — one new path kind would break every status response it reads.