Struct ClientVersionPolicy
pub struct ClientVersionPolicy { /* private fields */ }quic only.Expand description
How a client picks its first flight’s version and what it lets the server negotiate (RFC 9368 §2.5, §3).
The default starts in Version::V1, lets a server move the connection to
Version::V2 without a round trip, and restarts in either version if the server answers
with a Version Negotiation packet. A TLS provider that cannot change version during the
handshake narrows the compatible set to the original version.
Implementations§
§impl ClientVersionPolicy
impl ClientVersionPolicy
pub fn new(original: Version) -> Result<ClientVersionPolicy, VersionPolicyError>
pub fn new(original: Version) -> Result<ClientVersionPolicy, VersionPolicyError>
Start in original and offer nothing else: no compatible switch and no restart.
pub fn compatible(&self) -> &[Version]
pub fn compatible(&self) -> &[Version]
The versions the first flight is compatible with, most preferred first. A server may move the connection to any of them during the handshake.
pub fn supported(&self) -> &[Version]
pub fn supported(&self) -> &[Version]
The versions a new first flight may use after a Version Negotiation packet, most preferred first.
pub fn reserved_version_grease(&self) -> ReservedVersionGrease
pub fn reserved_version_grease(&self) -> ReservedVersionGrease
Whether, and where, a reserved version is added to the advertised list (RFC 9368 §3).
pub fn needs_switch(&self) -> bool
pub fn needs_switch(&self) -> bool
Whether this policy may need the TLS session to change version mid-handshake.
pub fn try_with_compatible(
self,
compatible: Vec<Version>,
) -> Result<ClientVersionPolicy, VersionPolicyError>
pub fn try_with_compatible( self, compatible: Vec<Version>, ) -> Result<ClientVersionPolicy, VersionPolicyError>
The versions the first flight is compatible with; must contain the original and only versions compatible with it.
pub fn try_with_supported(
self,
supported: Vec<Version>,
) -> Result<ClientVersionPolicy, VersionPolicyError>
pub fn try_with_supported( self, supported: Vec<Version>, ) -> Result<ClientVersionPolicy, VersionPolicyError>
The versions a restart after Version Negotiation may pick from; must contain the original.
pub fn with_reserved_version_grease(
self,
grease: ReservedVersionGrease,
) -> ClientVersionPolicy
pub fn with_reserved_version_grease( self, grease: ReservedVersionGrease, ) -> ClientVersionPolicy
Whether, and where, to add a reserved version to the advertised compatible list. Last by default.
pub fn set_reserved_version_grease(
&mut self,
grease: ReservedVersionGrease,
) -> &mut ClientVersionPolicy
pub fn set_reserved_version_grease( &mut self, grease: ReservedVersionGrease, ) -> &mut ClientVersionPolicy
Whether, and where, to add a reserved version to the advertised compatible list. Last by default.
pub fn with_resume_in_ticket_version(self, resume: bool) -> ClientVersionPolicy
pub fn with_resume_in_ticket_version(self, resume: bool) -> ClientVersionPolicy
Whether a first flight to a server that issued a session ticket in another supported version starts in that version, so the ticket can resume it (RFC 9369 §5, §6). On for the default policy; off once a first flight version is chosen explicitly, until turned on again here.
pub fn set_resume_in_ticket_version(
&mut self,
resume: bool,
) -> &mut ClientVersionPolicy
pub fn set_resume_in_ticket_version( &mut self, resume: bool, ) -> &mut ClientVersionPolicy
Whether a first flight to a server that issued a session ticket in another supported version starts in that version, so the ticket can resume it (RFC 9369 §5, §6). On for the default policy; off once a first flight version is chosen explicitly, until turned on again here.
pub fn resumes_in_ticket_version(&self) -> bool
pub fn resumes_in_ticket_version(&self) -> bool
Whether a first flight follows the version of a held session ticket.
pub fn for_ticket(&self, ticket: Option<Version>) -> ClientVersionPolicy
pub fn for_ticket(&self, ticket: Option<Version>) -> ClientVersionPolicy
The policy for an attempt to a server that issued a ticket in ticket: the same policy
starting in that version when it is supported and following tickets is on.
pub fn with_original(
self,
original: Version,
) -> Result<ClientVersionPolicy, VersionPolicyError>
pub fn with_original( self, original: Version, ) -> Result<ClientVersionPolicy, VersionPolicyError>
Start in original, keeping the rest of the policy and adding original to its lists.
pub fn narrowed_public(self) -> ClientVersionPolicy
pub fn narrowed_public(self) -> ClientVersionPolicy
The same policy with no compatible version other than the original, so no switch is needed. A backend that cannot change version mid-handshake uses this.
pub fn narrowed(self) -> ClientVersionPolicy
pub fn narrowed(self) -> ClientVersionPolicy
The same policy without a compatible switch, for a TLS session that cannot change version.
pub fn all_versions(&self) -> impl Iterator<Item = Version>
pub fn all_versions(&self) -> impl Iterator<Item = Version>
Every version the endpoint must be able to decode for this policy.
pub fn select(&self, offered: &[Version]) -> Option<Version>
pub fn select(&self, offered: &[Version]) -> Option<Version>
The version this client would pick from a server’s list, by its own preference order, ignoring reserved versions (RFC 9368 §2.1, §4).
pub fn information(&self, grease: Version) -> VersionInformation
pub fn information(&self, grease: Version) -> VersionInformation
What the client advertises: its original version and, in preference order, what the first flight is compatible with.
Trait Implementations§
§impl Clone for ClientVersionPolicy
impl Clone for ClientVersionPolicy
§fn clone(&self) -> ClientVersionPolicy
fn clone(&self) -> ClientVersionPolicy
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 ClientVersionPolicy
impl Debug for ClientVersionPolicy
§impl Default for ClientVersionPolicy
impl Default for ClientVersionPolicy
§fn default() -> ClientVersionPolicy
fn default() -> ClientVersionPolicy
§impl<'de> Deserialize<'de> for ClientVersionPolicy
impl<'de> Deserialize<'de> for ClientVersionPolicy
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ClientVersionPolicy, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ClientVersionPolicy, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for ClientVersionPolicy
§impl PartialEq for ClientVersionPolicy
impl PartialEq for ClientVersionPolicy
§impl Serialize for ClientVersionPolicy
impl Serialize for ClientVersionPolicy
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for ClientVersionPolicy
§impl TryFrom<ClientVersionPolicyRepr> for ClientVersionPolicy
impl TryFrom<ClientVersionPolicyRepr> for ClientVersionPolicy
§type Error = VersionPolicyError
type Error = VersionPolicyError
§fn try_from(
repr: ClientVersionPolicyRepr,
) -> Result<ClientVersionPolicy, <ClientVersionPolicy as TryFrom<ClientVersionPolicyRepr>>::Error>
fn try_from( repr: ClientVersionPolicyRepr, ) -> Result<ClientVersionPolicy, <ClientVersionPolicy as TryFrom<ClientVersionPolicyRepr>>::Error>
Auto Trait Implementations§
impl Freeze for ClientVersionPolicy
impl RefUnwindSafe for ClientVersionPolicy
impl Send for ClientVersionPolicy
impl Sync for ClientVersionPolicy
impl Unpin for ClientVersionPolicy
impl UnsafeUnpin for ClientVersionPolicy
impl UnwindSafe for ClientVersionPolicy
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> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§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