Struct PeekQuicClientHelloService
pub struct PeekQuicClientHelloService<K, S, F = RejectService<(), NoQuicRejectError>, R = NoQuicPeekRouting> { /* private fields */ }quic and std only.Expand description
Inspects the first datagrams of a UDP association for a QUIC client’s Initial flight and its ClientHello, then hands the association on with those datagrams replayed in front.
A complete ClientHello goes to the inner service as InputWithQuicClientHello. Anything
else ends in a QuicPeekRejection: classes the QuicPeekFallbackPolicy admits go to
the fallback with the same datagrams intact and the rejection in the input’s extensions, so
the fallback can still forward the association untouched; the others fail with
QuicPeekRejectedError. Nothing is ever sent while peeking: the decision is made before
any local QUIC output exists. The deadline is absolute from serve, and the read ahead is
bounded by CaptureLimits. Defaults use DEFAULT_QUIC_PEEK_LIMITS and
select the configured fallback for every rejection. Use
Self::with_malformed_tls_policy and Self::with_peek_policy for
the same policy controls as TCP, or Self::with_fallback_policy for per-class
QUIC control. The last applicable setter wins.
Both successful and fallback dispatch insert ClientHelloPeekStatus, replacing
any earlier status. Non-QUIC input has no inspection failure. Unsupported or
malformed QUIC maps to Rejected, budget exhaustion to MaxPeekSizeReached,
and its own inspection deadline, a bound on buffered datagrams, to Cancelled.
Receive errors always fail the service.
Like the TCP peekers, it waits within the scope the association runs in: once
that scope is cancelled the PeekPolicy decides by the progress made
(fallback with QuicPeekRejection::Cancelled, fail, or keep waiting), and
once it is aborted the peek fails with PeekCutoffError.
Strict routing should use QuicPeekFallbackPolicy::NOT_QUIC.
Routing sees the outer ClientHello only: with ECH that is the public name, never the
encrypted inner one. 0-RTT in the first flight is never decrypted: it is flagged as
PeekedClientHello::early_data_observed and replayed untouched to a forwarding service,
while a terminating relay rejects it and the client resends that data after the handshake.
The fallback rejects by default; use Self::with_fallback to forward instead.
Implementations§
§impl<K, S> PeekQuicClientHelloService<K, S>
impl<K, S> PeekQuicClientHelloService<K, S>
pub fn into_inner(self) -> S
pub fn into_inner(self) -> S
Consumes self, returning the underlying service.
pub fn new(keys: K, inner: S) -> PeekQuicClientHelloService<K, S>
pub fn new(keys: K, inner: S) -> PeekQuicClientHelloService<K, S>
Peek with keys deriving the Initial keys of the client’s offered version. No
certificate or server identity is needed.
§impl<K, S, F, R> PeekQuicClientHelloService<K, S, F, R>
impl<K, S, F, R> PeekQuicClientHelloService<K, S, F, R>
pub fn with_router<T>(self, router: T) -> PeekQuicClientHelloService<K, S, F, T>
pub fn with_router<T>(self, router: T) -> PeekQuicClientHelloService<K, S, F, T>
Route existing connections before inspecting a new handshake, using the same receive buffer, timeout and cancellation policy. Only the first datagram is offered to the router. The default adds no routing lookup.
pub fn with_fallback<G>(
self,
fallback: G,
) -> PeekQuicClientHelloService<K, S, G, R>
pub fn with_fallback<G>( self, fallback: G, ) -> PeekQuicClientHelloService<K, S, G, R>
Hand associations the fallback policy admits to fallback.
pub fn with_first_flight_retention(
self,
retain: bool,
) -> PeekQuicClientHelloService<K, S, F, R>
pub fn with_first_flight_retention( self, retain: bool, ) -> PeekQuicClientHelloService<K, S, F, R>
Retain structural facts through the datagram completing ClientHello (default: on). A native mirror uses these facts for fresh Initial packetization and CID lengths.
pub fn set_first_flight_retention(
&mut self,
retain: bool,
) -> &mut PeekQuicClientHelloService<K, S, F, R>
pub fn set_first_flight_retention( &mut self, retain: bool, ) -> &mut PeekQuicClientHelloService<K, S, F, R>
Retain structural facts through the datagram completing ClientHello (default: on). A native mirror uses these facts for fresh Initial packetization and CID lengths.
pub fn with_limits(
self,
limits: CaptureLimits,
) -> PeekQuicClientHelloService<K, S, F, R>
pub fn with_limits( self, limits: CaptureLimits, ) -> PeekQuicClientHelloService<K, S, F, R>
Bounds on datagrams, packets, bytes, CRYPTO fragments and the ClientHello.
Defaults to DEFAULT_QUIC_PEEK_LIMITS. Reaching a bound stops inspection
and follows the configured fallback policy.
pub fn set_limits(
&mut self,
limits: CaptureLimits,
) -> &mut PeekQuicClientHelloService<K, S, F, R>
pub fn set_limits( &mut self, limits: CaptureLimits, ) -> &mut PeekQuicClientHelloService<K, S, F, R>
Bounds on datagrams, packets, bytes, CRYPTO fragments and the ClientHello.
Defaults to DEFAULT_QUIC_PEEK_LIMITS. Reaching a bound stops inspection
and follows the configured fallback policy.
pub fn with_peek_timeout(
self,
timeout: Duration,
) -> PeekQuicClientHelloService<K, S, F, R>
pub fn with_peek_timeout( self, timeout: Duration, ) -> PeekQuicClientHelloService<K, S, F, R>
How long the whole inspection may take, from serve. Defaults to
DEFAULT_QUIC_PEEK_TIMEOUT.
pub fn set_peek_timeout(
&mut self,
timeout: Duration,
) -> &mut PeekQuicClientHelloService<K, S, F, R>
pub fn set_peek_timeout( &mut self, timeout: Duration, ) -> &mut PeekQuicClientHelloService<K, S, F, R>
How long the whole inspection may take, from serve. Defaults to
DEFAULT_QUIC_PEEK_TIMEOUT.
pub fn with_malformed_tls_policy(
self,
policy: MalformedTlsPolicy,
) -> PeekQuicClientHelloService<K, S, F, R>
pub fn with_malformed_tls_policy( self, policy: MalformedTlsPolicy, ) -> PeekQuicClientHelloService<K, S, F, R>
Whether malformed, unsupported or over-budget QUIC reaches fallback.
Defaults to MalformedTlsPolicy::Fallback. This updates those three
classes only; timeout and non-QUIC policy remain independent.
pub fn set_malformed_tls_policy(
&mut self,
policy: MalformedTlsPolicy,
) -> &mut PeekQuicClientHelloService<K, S, F, R>
pub fn set_malformed_tls_policy( &mut self, policy: MalformedTlsPolicy, ) -> &mut PeekQuicClientHelloService<K, S, F, R>
Whether malformed, unsupported or over-budget QUIC reaches fallback.
Defaults to MalformedTlsPolicy::Fallback. This updates those three
classes only; timeout and non-QUIC policy remain independent.
pub fn with_peek_policy(
self,
policy: PeekPolicy,
) -> PeekQuicClientHelloService<K, S, F, R>
pub fn with_peek_policy( self, policy: PeekPolicy, ) -> PeekQuicClientHelloService<K, S, F, R>
How a cancelled scope and the inspection deadline are handled.
Defaults to PeekPolicy::FAIL_OPEN, independently of the malformed-TLS policy.
A cancelled scope the association runs in applies the cancel action for
the progress made; an aborted scope always fails. The inspection
deadline, a bound on buffered datagrams, follows the partial cancel
action, as the first datagram is in hand; there PeekAction::Wait fails.
pub fn set_peek_policy(
&mut self,
policy: PeekPolicy,
) -> &mut PeekQuicClientHelloService<K, S, F, R>
pub fn set_peek_policy( &mut self, policy: PeekPolicy, ) -> &mut PeekQuicClientHelloService<K, S, F, R>
How a cancelled scope and the inspection deadline are handled.
Defaults to PeekPolicy::FAIL_OPEN, independently of the malformed-TLS policy.
A cancelled scope the association runs in applies the cancel action for
the progress made; an aborted scope always fails. The inspection
deadline, a bound on buffered datagrams, follows the partial cancel
action, as the first datagram is in hand; there PeekAction::Wait fails.
pub fn with_fallback_policy(
self,
policy: QuicPeekFallbackPolicy,
) -> PeekQuicClientHelloService<K, S, F, R>
pub fn with_fallback_policy( self, policy: QuicPeekFallbackPolicy, ) -> PeekQuicClientHelloService<K, S, F, R>
Which rejections reach the fallback. Defaults to
QuicPeekFallbackPolicy::ALL.
pub fn set_fallback_policy(
&mut self,
policy: QuicPeekFallbackPolicy,
) -> &mut PeekQuicClientHelloService<K, S, F, R>
pub fn set_fallback_policy( &mut self, policy: QuicPeekFallbackPolicy, ) -> &mut PeekQuicClientHelloService<K, S, F, R>
Which rejections reach the fallback. Defaults to
QuicPeekFallbackPolicy::ALL.
Trait Implementations§
§impl<K, S, F, R> Clone for PeekQuicClientHelloService<K, S, F, R>
impl<K, S, F, R> Clone for PeekQuicClientHelloService<K, S, F, R>
§fn clone(&self) -> PeekQuicClientHelloService<K, S, F, R>
fn clone(&self) -> PeekQuicClientHelloService<K, S, F, R>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl<K, S, F, R> Debug for PeekQuicClientHelloService<K, S, F, R>
impl<K, S, F, R> Debug for PeekQuicClientHelloService<K, S, F, R>
§impl<K, S, F, R> ExtensionsRef for PeekQuicClientHelloService<K, S, F, R>where
S: ExtensionsRef,
impl<K, S, F, R> ExtensionsRef for PeekQuicClientHelloService<K, S, F, R>where
S: ExtensionsRef,
§fn extensions(&self) -> &Extensions
fn extensions(&self) -> &Extensions
Extensions store§impl<I, K, S, F, O, R> Service<I> for PeekQuicClientHelloService<K, S, F, R>where
I: DatagramPeekInput + ExtensionsRef,
<I as DatagramPeekInput>::Mapped<PrefixedDatagramSocket<<I as DatagramPeekInput>::Socket>>: ExtensionsRef,
K: KeyProvider + Send + Sync + 'static,
S: Service<InputWithQuicClientHello<<I as DatagramPeekInput>::Mapped<PrefixedDatagramSocket<<I as DatagramPeekInput>::Socket>>>, Output = O>,
<S as Service<InputWithQuicClientHello<<I as DatagramPeekInput>::Mapped<PrefixedDatagramSocket<<I as DatagramPeekInput>::Socket>>>>>::Error: Into<Box<dyn Error + Send + Sync>>,
F: Service<<I as DatagramPeekInput>::Mapped<PrefixedDatagramSocket<<I as DatagramPeekInput>::Socket>>, Output = O>,
<F as Service<<I as DatagramPeekInput>::Mapped<PrefixedDatagramSocket<<I as DatagramPeekInput>::Socket>>>>::Error: Into<Box<dyn Error + Send + Sync>>,
O: Send + 'static,
R: QuicPeekRouter<O>,
impl<I, K, S, F, O, R> Service<I> for PeekQuicClientHelloService<K, S, F, R>where
I: DatagramPeekInput + ExtensionsRef,
<I as DatagramPeekInput>::Mapped<PrefixedDatagramSocket<<I as DatagramPeekInput>::Socket>>: ExtensionsRef,
K: KeyProvider + Send + Sync + 'static,
S: Service<InputWithQuicClientHello<<I as DatagramPeekInput>::Mapped<PrefixedDatagramSocket<<I as DatagramPeekInput>::Socket>>>, Output = O>,
<S as Service<InputWithQuicClientHello<<I as DatagramPeekInput>::Mapped<PrefixedDatagramSocket<<I as DatagramPeekInput>::Socket>>>>>::Error: Into<Box<dyn Error + Send + Sync>>,
F: Service<<I as DatagramPeekInput>::Mapped<PrefixedDatagramSocket<<I as DatagramPeekInput>::Socket>>, Output = O>,
<F as Service<<I as DatagramPeekInput>::Mapped<PrefixedDatagramSocket<<I as DatagramPeekInput>::Socket>>>>::Error: Into<Box<dyn Error + Send + Sync>>,
O: Send + 'static,
R: QuicPeekRouter<O>,
Auto Trait Implementations§
impl<K, S, F, R> Forget for PeekQuicClientHelloService<K, S, F, R>
impl<K, S, F, R> Freeze for PeekQuicClientHelloService<K, S, F, R>
impl<K, S, F, R> Move for PeekQuicClientHelloService<K, S, F, R>
impl<K, S, F, R> RefUnwindSafe for PeekQuicClientHelloService<K, S, F, R>
impl<K, S, F, R> Send for PeekQuicClientHelloService<K, S, F, R>
impl<K, S, F, R> Sync for PeekQuicClientHelloService<K, S, F, R>
impl<K, S, F, R> Unpin for PeekQuicClientHelloService<K, S, F, R>
impl<K, S, F, R> UnsafeUnpin for PeekQuicClientHelloService<K, S, F, R>
impl<K, S, F, R> UnwindSafe for PeekQuicClientHelloService<K, S, F, R>
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<S, Input, Connection> ConnectorService<Input> for Swhere
S: Service<Input, Output = EstablishedClientConnection<Connection, Input>>,
<S as Service<Input>>::Error: Into<ConnectionError>,
Connection: Send + ExtensionsRef,
impl<S, Input, Connection> ConnectorService<Input> for Swhere
S: Service<Input, Output = EstablishedClientConnection<Connection, Input>>,
<S as Service<Input>>::Error: Into<ConnectionError>,
Connection: Send + ExtensionsRef,
§type Connection = Connection
type Connection = Connection
ConnectorService§fn connect(
&self,
input: Input,
) -> impl Future<Output = Result<EstablishedClientConnection<<S as ConnectorService<Input>>::Connection, Input>, ConnectionError>> + Send
fn connect( &self, input: Input, ) -> impl Future<Output = Result<EstablishedClientConnection<<S as ConnectorService<Input>>::Connection, Input>, ConnectionError>> + Send
§impl<T> ForwardedClientExt for Twhere
T: ExtensionsRef + ?Sized,
impl<T> ForwardedClientExt for Twhere
T: ExtensionsRef + ?Sized,
§fn trusted_forwarded(&self) -> Option<&Forwarded>
fn trusted_forwarded(&self) -> Option<&Forwarded>
§fn forwarded_client(&self) -> Option<&ForwardedElement>
fn forwarded_client(&self) -> Option<&ForwardedElement>
§fn forwarded_client_ip(&self) -> Option<IpAddr>
fn forwarded_client_ip(&self) -> Option<IpAddr>
for node.§fn forwarded_client_socket_addr(&self) -> Option<SocketAddress>
fn forwarded_client_socket_addr(&self) -> Option<SocketAddress>
for node.§fn forwarded_client_host(&self) -> Option<&ForwardedAuthority>
fn forwarded_client_host(&self) -> Option<&ForwardedAuthority>
§fn forwarded_client_proto(&self) -> Option<ForwardedProtocol>
fn forwarded_client_proto(&self) -> Option<ForwardedProtocol>
§fn forwarded_client_version(&self) -> Option<ForwardedVersion>
fn forwarded_client_version(&self) -> Option<ForwardedVersion>
§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