pub struct QuicPathSet { /* private fields */ }Expand description
RFC 9000 § 9 container for the primary path plus any concurrent probing paths during a migration attempt. Sends and receives are tracked per path so anti-amplification accounting follows the actual peer address.
Implementations§
Source§impl QuicPathSet
impl QuicPathSet
pub fn new() -> Self
Sourcepub fn install_primary(&mut self, peer_addr: SocketAddr) -> &QuicPath
pub fn install_primary(&mut self, peer_addr: SocketAddr) -> &QuicPath
Install the handshake peer address as the primary path. Already validated per RFC 9000 § 8.1 (the handshake itself validates the path).
Sourcepub fn observe_packet_from(
&mut self,
peer_addr: SocketAddr,
len: usize,
now: Instant,
)
pub fn observe_packet_from( &mut self, peer_addr: SocketAddr, len: usize, now: Instant, )
Observe an inbound packet from peer_addr. If the address is new it is
added as a Probing path; in either case the per-path
received-byte counter is incremented for anti-amplification accounting.
Sourcepub fn record_sent_to(
&mut self,
peer_addr: SocketAddr,
len: usize,
) -> Option<u64>
pub fn record_sent_to( &mut self, peer_addr: SocketAddr, len: usize, ) -> Option<u64>
Record bytes sent to peer_addr so anti-amplification accounting
stays accurate. Returns the per-path remaining send budget after the
accounting update.
Sourcepub fn may_send_to(
&self,
peer_addr: SocketAddr,
additional_bytes: usize,
) -> bool
pub fn may_send_to( &self, peer_addr: SocketAddr, additional_bytes: usize, ) -> bool
Whether the endpoint may send additional_bytes to peer_addr under
the current anti-amplification budget.
Sourcepub fn issue_challenge(&mut self, peer_addr: SocketAddr, token: [u8; 8]) -> bool
pub fn issue_challenge(&mut self, peer_addr: SocketAddr, token: [u8; 8]) -> bool
Issue a PATH_CHALLENGE token for peer_addr. Returns true if a probing
or primary path exists for that address.
Sourcepub fn observe_path_response(
&mut self,
peer_addr: SocketAddr,
token: [u8; 8],
) -> bool
pub fn observe_path_response( &mut self, peer_addr: SocketAddr, token: [u8; 8], ) -> bool
Observe a PATH_RESPONSE from peer_addr. Returns true if the token
matched an outstanding challenge on that path; the path transitions to
Validated and its anti-amplification budget is removed.
Sourcepub fn promote_to_primary(&mut self, peer_addr: SocketAddr) -> bool
pub fn promote_to_primary(&mut self, peer_addr: SocketAddr) -> bool
Promote peer_addr from Validated to Primary and demote any
existing primary to Abandoned (RFC 9000 § 9.5).
pub fn primary(&self) -> Option<&QuicPath>
pub fn path(&self, peer_addr: SocketAddr) -> Option<&QuicPath>
pub fn paths(&self) -> &[QuicPath]
Sourcepub fn mark_validated(&mut self, peer_addr: SocketAddr) -> bool
pub fn mark_validated(&mut self, peer_addr: SocketAddr) -> bool
Mark a known path as validated without requiring a PATH_RESPONSE token match. Used when handshake-level validation state is authoritative.