Skip to main content

QuicPathSet

Struct QuicPathSet 

Source
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

Source

pub fn new() -> Self

Source

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).

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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).

Source

pub fn primary(&self) -> Option<&QuicPath>

Source

pub fn path(&self, peer_addr: SocketAddr) -> Option<&QuicPath>

Source

pub fn paths(&self) -> &[QuicPath]

Source

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.

Source

pub fn is_known_address(&self, peer_addr: SocketAddr) -> bool

Source

pub fn is_probing_address(&self, peer_addr: SocketAddr) -> bool

Trait Implementations§

Source§

impl Debug for QuicPathSet

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for QuicPathSet

Source§

fn default() -> QuicPathSet

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more