Struct ValidationTokenConfig
pub struct ValidationTokenConfig { /* private fields */ }quic and std only.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§
§impl ValidationTokenConfig
impl ValidationTokenConfig
pub fn with_lifetime(self, value: Duration) -> ValidationTokenConfig
pub fn with_lifetime(self, value: Duration) -> 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.
pub fn set_lifetime(&mut self, value: Duration) -> &mut ValidationTokenConfig
pub fn set_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.
pub fn with_log(self, log: Arc<dyn TokenLog>) -> ValidationTokenConfig
pub fn with_log(self, log: Arc<dyn TokenLog>) -> ValidationTokenConfig
Set a custom TokenLog
Defaults to a default BloomTokenLog, which is suitable for most internet applications.
Use [NoneTokenLog] to make the server ignore all address validation tokens (that is,
tokens originating from NEW_TOKEN frames–retry tokens are not affected).
pub fn set_log(&mut self, log: Arc<dyn TokenLog>) -> &mut ValidationTokenConfig
pub fn set_log(&mut self, log: Arc<dyn TokenLog>) -> &mut ValidationTokenConfig
Set a custom TokenLog
Defaults to a default BloomTokenLog, which is suitable for most internet applications.
Use [NoneTokenLog] to make the server ignore all address validation tokens (that is,
tokens originating from NEW_TOKEN frames–retry tokens are not affected).
pub fn with_sent(self, value: u32) -> ValidationTokenConfig
pub fn with_sent(self, value: u32) -> 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 2.
pub fn set_sent(&mut self, value: u32) -> &mut ValidationTokenConfig
pub fn set_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 2.
Trait Implementations§
§impl Clone for ValidationTokenConfig
impl Clone for ValidationTokenConfig
§fn clone(&self) -> ValidationTokenConfig
fn clone(&self) -> ValidationTokenConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for ValidationTokenConfig
impl Debug for ValidationTokenConfig
§impl Default for ValidationTokenConfig
impl Default for ValidationTokenConfig
§fn default() -> ValidationTokenConfig
fn default() -> ValidationTokenConfig
Auto Trait Implementations§
impl !RefUnwindSafe for ValidationTokenConfig
impl !UnwindSafe for ValidationTokenConfig
impl Freeze for ValidationTokenConfig
impl Send for ValidationTokenConfig
impl Sync for ValidationTokenConfig
impl Unpin for ValidationTokenConfig
impl UnsafeUnpin for ValidationTokenConfig
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more