Struct ValidationTokenConfig

Source
pub struct ValidationTokenConfig { /* private fields */ }
Expand description

Configuration for sending and handling validation tokens in incoming connections

Default values should be suitable for most internet applications.

§QUIC Tokens

The QUIC protocol defines a concept of “address validation”. Essentially, one side of a QUIC connection may appear to be receiving QUIC packets from a particular remote UDP address, but it will only consider that remote address “validated” once it has convincing evidence that the address is not being spoofed.

Validation is important primarily because of QUIC’s “anti-amplification limit.” This limit prevents a QUIC server from sending a client more than three times the number of bytes it has received from the client on a given address until that address is validated. This is designed to mitigate the ability of attackers to use QUIC-based servers as reflectors in amplification attacks.

A path may become validated in several ways. The server is always considered validated by the client. The client usually begins in an unvalidated state upon first connecting or migrating, but then becomes validated through various mechanisms that usually take one network round trip. However, in some cases, a client which has previously attempted to connect to a server may have been given a one-time use cryptographically secured “token” that it can send in a subsequent connection attempt to be validated immediately.

There are two ways these tokens can originate:

  • If the server responds to an incoming connection with retry, a “retry token” is minted and sent to the client, which the client immediately uses to attempt to connect again. Retry tokens operate on short timescales, such as 15 seconds.
  • If a client’s path within an active connection is validated, the server may send the client one or more “validation tokens,” which the client may store for use in later connections to the same server. Validation tokens may be valid for much longer lifetimes than retry token.

The usage of validation tokens is most impactful in situations where 0-RTT data is also being used–in particular, in situations where the server sends the client more than three times more 0.5-RTT data than it has received 0-RTT data. Since the successful completion of a connection handshake implicitly causes the client’s address to be validated, transmission of 0.5-RTT data is the main situation where a server might be sending application data to an address that could be validated by token usage earlier than it would become validated without token usage.

These tokens should not be confused with “stateless reset tokens,” which are similarly named but entirely unrelated.

Implementations§

Source§

impl ValidationTokenConfig

Source

pub fn lifetime(&mut self, value: Duration) -> &mut ValidationTokenConfig

Duration after an address validation token was issued for which it’s considered valid

This refers only to tokens sent in NEW_TOKEN frames, in contrast to retry tokens.

Defaults to 2 weeks.

Source

pub fn log(&mut self, log: Arc<dyn TokenLog>) -> &mut ValidationTokenConfig

Set a custom TokenLog

Defaults to NoneTokenLog, which makes the server ignore all address validation tokens (that is, tokens originating from NEW_TOKEN frames–retry tokens are not affected).

Source

pub fn sent(&mut self, value: u32) -> &mut ValidationTokenConfig

Number of address validation tokens sent to a client when its path is validated

This refers only to tokens sent in NEW_TOKEN frames, in contrast to retry tokens.

Defaults to 0.

Trait Implementations§

Source§

impl Clone for ValidationTokenConfig

Source§

fn clone(&self) -> ValidationTokenConfig

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ValidationTokenConfig

Source§

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

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

impl Default for ValidationTokenConfig

Source§

fn default() -> ValidationTokenConfig

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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