Struct HashedConnectionIdGenerator
pub struct HashedConnectionIdGenerator { /* private fields */ }quic and std only.Expand description
Generates 8-byte connection IDs that can be efficiently
validated
This generator uses a non-cryptographic hash and can therefore still be spoofed, but nonetheless helps prevent the endpoint from responding to non-QUIC packets at very low cost.
Implementations§
§impl HashedConnectionIdGenerator
impl HashedConnectionIdGenerator
pub fn new() -> HashedConnectionIdGenerator
pub fn new() -> HashedConnectionIdGenerator
A generator with a random key, so its identifiers are recognised only by itself.
pub fn from_key(key: u64) -> HashedConnectionIdGenerator
pub fn from_key(key: u64) -> HashedConnectionIdGenerator
A generator with a key of your own.
Endpoints given the same key recognise one another’s identifiers through
validate, which is what lets a restarted endpoint,
or another endpoint of the same service, tell a connection of its own from noise.
pub fn maybe_with_lifetime(
self,
lifetime: Option<Duration>,
) -> HashedConnectionIdGenerator
pub fn maybe_with_lifetime( self, lifetime: Option<Duration>, ) -> HashedConnectionIdGenerator
How long the identifiers this generator creates are used before they are retired.
None, the default, retires them only when the peer or the protocol asks.
pub fn maybe_set_lifetime(
&mut self,
lifetime: Option<Duration>,
) -> &mut HashedConnectionIdGenerator
pub fn maybe_set_lifetime( &mut self, lifetime: Option<Duration>, ) -> &mut HashedConnectionIdGenerator
How long the identifiers this generator creates are used before they are retired.
None, the default, retires them only when the peer or the protocol asks.
pub fn with_lifetime(self, lifetime: Duration) -> HashedConnectionIdGenerator
pub fn with_lifetime(self, lifetime: Duration) -> HashedConnectionIdGenerator
How long the identifiers this generator creates are used before they are retired.
None, the default, retires them only when the peer or the protocol asks.
pub fn set_lifetime(
&mut self,
lifetime: Duration,
) -> &mut HashedConnectionIdGenerator
pub fn set_lifetime( &mut self, lifetime: Duration, ) -> &mut HashedConnectionIdGenerator
How long the identifiers this generator creates are used before they are retired.
None, the default, retires them only when the peer or the protocol asks.
pub fn without_lifetime(self) -> HashedConnectionIdGenerator
pub fn without_lifetime(self) -> HashedConnectionIdGenerator
How long the identifiers this generator creates are used before they are retired.
None, the default, retires them only when the peer or the protocol asks.
pub fn unset_lifetime(&mut self) -> &mut HashedConnectionIdGenerator
pub fn unset_lifetime(&mut self) -> &mut HashedConnectionIdGenerator
How long the identifiers this generator creates are used before they are retired.
None, the default, retires them only when the peer or the protocol asks.
Trait Implementations§
§impl ConnectionIdGenerator for HashedConnectionIdGenerator
impl ConnectionIdGenerator for HashedConnectionIdGenerator
§fn generate_cid(&mut self) -> ConnectionId
fn generate_cid(&mut self) -> ConnectionId
§fn validate(&self, cid: &ConnectionId) -> Result<(), InvalidCid>
fn validate(&self, cid: &ConnectionId) -> Result<(), InvalidCid>
cid could have been generated by this generator Read more§fn cid_lifetime(&self) -> Option<Duration>
fn cid_lifetime(&self) -> Option<Duration>
§impl Default for HashedConnectionIdGenerator
impl Default for HashedConnectionIdGenerator
§fn default() -> HashedConnectionIdGenerator
fn default() -> HashedConnectionIdGenerator
Auto Trait Implementations§
impl Freeze for HashedConnectionIdGenerator
impl RefUnwindSafe for HashedConnectionIdGenerator
impl Send for HashedConnectionIdGenerator
impl Sync for HashedConnectionIdGenerator
impl Unpin for HashedConnectionIdGenerator
impl UnsafeUnpin for HashedConnectionIdGenerator
impl UnwindSafe for HashedConnectionIdGenerator
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
§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