pub struct MultiHopAssignment {
pub exit: NodeId,
pub forwarder_chain: Vec<ForwarderLease>,
pub client_wg_config: WgPeerConfig,
}Expand description
Multi-hop match: client routes through a chain of forwarders to an exit (R-MULTIHOP-PROTO).
Carries everything the client needs to bring its WireGuard session
up — the public side of the client↔exit session plus the
per-forwarder lease rows the forwarders need to authorise the
relayed packets.
§Structural invariants (unrepresentable invalid states)
- Non-empty chain.
Self::forwarder_chainholds at least oneForwarderLease; multi-hop with zero forwarders is by definition the single-hop case, which lives inMatchResponse::SingleHop. Validated on deserialize via aserde(try_from = ...)shim that surfaces an empty chain as aMultiHopAssignmentError::EmptyChaininside the standard postcard / serde error path. - Forwarder ↔ lease binding by construction. Each chain entry
IS a
ForwarderLease, so theForwarderLease::forwarderNodeIdand its lease row are one element — no parallelVecs, no positional-alignment bug surface. The flow direction is theVec’s order: traffic entersforwarder_chain[0], hops through each successor, and exits the chain atforwarder_chain[last]’s downstream socket (which terminates onSelf::exit).
See crate::multihop for the on-the-wire packet-to-lease binding
mechanism (chosen: option (B), explicit relay framing).
Fields§
§exit: NodeIdFinal exit serving the client’s traffic.
forwarder_chain: Vec<ForwarderLease>Ordered forwarder chain between the client and exit.
The client sends its outbound WireGuard packets to
forwarder_chain[0]’s upstream socket; each forwarder relays
to the next; the last entry relays to exit. Non-empty by
construction — see the type-level invariants section.
client_wg_config: WgPeerConfigClient-facing WireGuard peer config for the client↔exit
session.
Trait Implementations§
Source§impl Clone for MultiHopAssignment
impl Clone for MultiHopAssignment
Source§fn clone(&self) -> MultiHopAssignment
fn clone(&self) -> MultiHopAssignment
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MultiHopAssignment
impl Debug for MultiHopAssignment
Source§impl<'de> Deserialize<'de> for MultiHopAssignment
impl<'de> Deserialize<'de> for MultiHopAssignment
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for MultiHopAssignment
impl PartialEq for MultiHopAssignment
Source§fn eq(&self, other: &MultiHopAssignment) -> bool
fn eq(&self, other: &MultiHopAssignment) -> bool
self and other values to be equal, and is used by ==.