Struct TlsPeekRouter
pub struct TlsPeekRouter<T, F = RejectService<(), NoTlsRejectError>, Pol = PeekPolicy> { /* private fields */ }tls only.Expand description
A Service router that can be used to support
tls traffic as well as non-tls traffic.
By default non-tls traffic is rejected using RejectService.
Use TlsPeekRouter::with_fallback to configure the fallback service.
A definitive non-TLS prefix invokes that fallback under any policy; an
inconclusive cutoff is handled by the PeekPolicy, see
TlsPeekRouter::with_peek_policy.
On a BridgeIo the server’s first bytes are judged by TlsEgressPredicate.
Implementations§
§impl<T> TlsPeekRouter<T>
impl<T> TlsPeekRouter<T>
pub fn new(tls_acceptor: T) -> TlsPeekRouter<T>
pub fn new(tls_acceptor: T) -> TlsPeekRouter<T>
Create a new TlsPeekRouter.
§impl<T, Pol> TlsPeekRouter<T, RejectService<(), NoTlsRejectError>, Pol>
impl<T, Pol> TlsPeekRouter<T, RejectService<(), NoTlsRejectError>, Pol>
pub fn with_fallback<F>(self, fallback: F) -> TlsPeekRouter<T, F, Pol>
pub fn with_fallback<F>(self, fallback: F) -> TlsPeekRouter<T, F, Pol>
Attach a fallback Service tp this TlsPeekRouter.
§impl<T, F, Pol> TlsPeekRouter<T, F, Pol>
impl<T, F, Pol> TlsPeekRouter<T, F, Pol>
pub fn with_max_egress_peek_size(
self,
max_egress_peek_size: NonZero<usize>,
) -> TlsPeekRouter<T, F, Pol>
pub fn with_max_egress_peek_size( self, max_egress_peek_size: NonZero<usize>, ) -> TlsPeekRouter<T, F, Pol>
Set the byte limit for peeking the egress.
pub fn set_max_egress_peek_size(
&mut self,
max_egress_peek_size: NonZero<usize>,
) -> &mut TlsPeekRouter<T, F, Pol>
pub fn set_max_egress_peek_size( &mut self, max_egress_peek_size: NonZero<usize>, ) -> &mut TlsPeekRouter<T, F, Pol>
Set the byte limit for peeking the egress.
pub fn with_peek_policy<Pol2>(
self,
peek_policy: Pol2,
) -> TlsPeekRouter<T, F, Pol2>
pub fn with_peek_policy<Pol2>( self, peek_policy: Pol2, ) -> TlsPeekRouter<T, F, Pol2>
Set how a peek cutoff is handled, using a static PeekPolicy
or a PeekPolicyProvider that selects one per input.
Defaults to PeekPolicy::FAIL_OPEN. A definitive non-TLS
prefix invokes the fallback under any policy.
Trait Implementations§
§impl<T, F, Pol> Clone for TlsPeekRouter<T, F, Pol>
impl<T, F, Pol> Clone for TlsPeekRouter<T, F, Pol>
§fn clone(&self) -> TlsPeekRouter<T, F, Pol>
fn clone(&self) -> TlsPeekRouter<T, F, Pol>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl<T, F, Pol> Debug for TlsPeekRouter<T, F, Pol>
impl<T, F, Pol> Debug for TlsPeekRouter<T, F, Pol>
§impl<PeekableInput, Output, T, F, Pol> Service<PeekableInput> for TlsPeekRouter<T, F, Pol>where
PeekableInput: PeekIoProvider + ExtensionsRef,
<PeekableInput as PeekIoProvider>::PeekIo: Unpin,
<PeekableInput as PeekIoProvider>::PeekEgressIo: Unpin,
Output: Send + 'static,
Pol: PeekPolicyProvider<PeekableInput>,
T: Service<<PeekableInput as PeekIoProvider>::Mapped<PrefixedIo<StackReader<rama_tls::::server::peek::TlsPrefixedIo::{constant#0}>, <PeekableInput as PeekIoProvider>::PeekIo>, PrefixedIo<ReplayReader, <PeekableInput as PeekIoProvider>::PeekEgressIo>>, Output = Output>,
<T as Service<<PeekableInput as PeekIoProvider>::Mapped<PrefixedIo<StackReader<rama_tls::::server::peek::TlsPrefixedIo::{constant#0}>, <PeekableInput as PeekIoProvider>::PeekIo>, PrefixedIo<ReplayReader, <PeekableInput as PeekIoProvider>::PeekEgressIo>>>>::Error: Into<Box<dyn Error + Send + Sync>>,
F: Service<<PeekableInput as PeekIoProvider>::Mapped<PrefixedIo<StackReader<rama_tls::::server::peek::TlsPrefixedIo::{constant#0}>, <PeekableInput as PeekIoProvider>::PeekIo>, PrefixedIo<ReplayReader, <PeekableInput as PeekIoProvider>::PeekEgressIo>>, Output = Output>,
<F as Service<<PeekableInput as PeekIoProvider>::Mapped<PrefixedIo<StackReader<rama_tls::::server::peek::TlsPrefixedIo::{constant#0}>, <PeekableInput as PeekIoProvider>::PeekIo>, PrefixedIo<ReplayReader, <PeekableInput as PeekIoProvider>::PeekEgressIo>>>>::Error: Into<Box<dyn Error + Send + Sync>>,
impl<PeekableInput, Output, T, F, Pol> Service<PeekableInput> for TlsPeekRouter<T, F, Pol>where
PeekableInput: PeekIoProvider + ExtensionsRef,
<PeekableInput as PeekIoProvider>::PeekIo: Unpin,
<PeekableInput as PeekIoProvider>::PeekEgressIo: Unpin,
Output: Send + 'static,
Pol: PeekPolicyProvider<PeekableInput>,
T: Service<<PeekableInput as PeekIoProvider>::Mapped<PrefixedIo<StackReader<rama_tls::::server::peek::TlsPrefixedIo::{constant#0}>, <PeekableInput as PeekIoProvider>::PeekIo>, PrefixedIo<ReplayReader, <PeekableInput as PeekIoProvider>::PeekEgressIo>>, Output = Output>,
<T as Service<<PeekableInput as PeekIoProvider>::Mapped<PrefixedIo<StackReader<rama_tls::::server::peek::TlsPrefixedIo::{constant#0}>, <PeekableInput as PeekIoProvider>::PeekIo>, PrefixedIo<ReplayReader, <PeekableInput as PeekIoProvider>::PeekEgressIo>>>>::Error: Into<Box<dyn Error + Send + Sync>>,
F: Service<<PeekableInput as PeekIoProvider>::Mapped<PrefixedIo<StackReader<rama_tls::::server::peek::TlsPrefixedIo::{constant#0}>, <PeekableInput as PeekIoProvider>::PeekIo>, PrefixedIo<ReplayReader, <PeekableInput as PeekIoProvider>::PeekEgressIo>>, Output = Output>,
<F as Service<<PeekableInput as PeekIoProvider>::Mapped<PrefixedIo<StackReader<rama_tls::::server::peek::TlsPrefixedIo::{constant#0}>, <PeekableInput as PeekIoProvider>::PeekIo>, PrefixedIo<ReplayReader, <PeekableInput as PeekIoProvider>::PeekEgressIo>>>>::Error: Into<Box<dyn Error + Send + Sync>>,
§async fn serve(
&self,
input: PeekableInput,
) -> Result<<TlsPeekRouter<T, F, Pol> as Service<PeekableInput>>::Output, <TlsPeekRouter<T, F, Pol> as Service<PeekableInput>>::Error>
async fn serve( &self, input: PeekableInput, ) -> Result<<TlsPeekRouter<T, F, Pol> as Service<PeekableInput>>::Output, <TlsPeekRouter<T, F, Pol> as Service<PeekableInput>>::Error>
§fn boxed(self) -> BoxService<Input, Self::Output, Self::Error>
fn boxed(self) -> BoxService<Input, Self::Output, Self::Error>
Auto Trait Implementations§
impl<T, F, Pol> Forget for TlsPeekRouter<T, F, Pol>
impl<T, F, Pol> Freeze for TlsPeekRouter<T, F, Pol>
impl<T, F, Pol> Move for TlsPeekRouter<T, F, Pol>
impl<T, F, Pol> RefUnwindSafe for TlsPeekRouter<T, F, Pol>
impl<T, F, Pol> Send for TlsPeekRouter<T, F, Pol>
impl<T, F, Pol> Sync for TlsPeekRouter<T, F, Pol>
impl<T, F, Pol> Unpin for TlsPeekRouter<T, F, Pol>
impl<T, F, Pol> UnsafeUnpin for TlsPeekRouter<T, F, Pol>
impl<T, F, Pol> UnwindSafe for TlsPeekRouter<T, F, Pol>
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> 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