Struct HaProxyLayer
#[non_exhaustive]pub struct HaProxyLayer<Pol = PeekPolicy> { /* private fields */ }haproxy only.Expand description
Layer to decode the HaProxy Protocol
Implementations§
§impl HaProxyLayer
impl HaProxyLayer
pub const fn new() -> HaProxyLayer
pub const fn new() -> HaProxyLayer
Create a new HaProxyLayer.
§impl<Pol> HaProxyLayer<Pol>
impl<Pol> HaProxyLayer<Pol>
pub fn with_peek(self, value: bool) -> HaProxyLayer<Pol>
pub fn with_peek(self, value: bool) -> HaProxyLayer<Pol>
Instruct HaProxyLayer to peek prior to comitting to the HaProxy protocol.
Doing so makes it possible to support traffic with or without the use of that data. This can be useful to run services locally (not behind a loadbalancer) as well as in the the cloud (production, behind a loadbalancer).
pub fn set_peek(&mut self, value: bool) -> &mut HaProxyLayer<Pol>
pub fn set_peek(&mut self, value: bool) -> &mut HaProxyLayer<Pol>
Instruct HaProxyLayer to peek prior to comitting to the HaProxy protocol.
Doing so makes it possible to support traffic with or without the use of that data. This can be useful to run services locally (not behind a loadbalancer) as well as in the the cloud (production, behind a loadbalancer).
pub fn maybe_with_peek_timeout(
self,
peek_timeout: Option<Duration>,
) -> HaProxyLayer<Pol>
pub fn maybe_with_peek_timeout( self, peek_timeout: Option<Duration>, ) -> HaProxyLayer<Pol>
Set the maximum time spent peeking for a PROXY header, see Self::with_peek.
A timeout is inconclusive. Use Self::with_peek_policy to choose
whether it treats the input as not PROXY, rejects the connection or
keeps waiting.
pub fn maybe_set_peek_timeout(
&mut self,
peek_timeout: Option<Duration>,
) -> &mut HaProxyLayer<Pol>
pub fn maybe_set_peek_timeout( &mut self, peek_timeout: Option<Duration>, ) -> &mut HaProxyLayer<Pol>
Set the maximum time spent peeking for a PROXY header, see Self::with_peek.
A timeout is inconclusive. Use Self::with_peek_policy to choose
whether it treats the input as not PROXY, rejects the connection or
keeps waiting.
pub fn with_peek_timeout(self, peek_timeout: Duration) -> HaProxyLayer<Pol>
pub fn with_peek_timeout(self, peek_timeout: Duration) -> HaProxyLayer<Pol>
Set the maximum time spent peeking for a PROXY header, see Self::with_peek.
A timeout is inconclusive. Use Self::with_peek_policy to choose
whether it treats the input as not PROXY, rejects the connection or
keeps waiting.
pub fn set_peek_timeout(
&mut self,
peek_timeout: Duration,
) -> &mut HaProxyLayer<Pol>
pub fn set_peek_timeout( &mut self, peek_timeout: Duration, ) -> &mut HaProxyLayer<Pol>
Set the maximum time spent peeking for a PROXY header, see Self::with_peek.
A timeout is inconclusive. Use Self::with_peek_policy to choose
whether it treats the input as not PROXY, rejects the connection or
keeps waiting.
pub fn without_peek_timeout(self) -> HaProxyLayer<Pol>
pub fn without_peek_timeout(self) -> HaProxyLayer<Pol>
Set the maximum time spent peeking for a PROXY header, see Self::with_peek.
A timeout is inconclusive. Use Self::with_peek_policy to choose
whether it treats the input as not PROXY, rejects the connection or
keeps waiting.
pub fn unset_peek_timeout(&mut self) -> &mut HaProxyLayer<Pol>
pub fn unset_peek_timeout(&mut self) -> &mut HaProxyLayer<Pol>
Set the maximum time spent peeking for a PROXY header, see Self::with_peek.
A timeout is inconclusive. Use Self::with_peek_policy to choose
whether it treats the input as not PROXY, rejects the connection or
keeps waiting.
pub fn with_peek_policy<Pol2>(self, peek_policy: Pol2) -> HaProxyLayer<Pol2>
pub fn with_peek_policy<Pol2>(self, peek_policy: Pol2) -> HaProxyLayer<Pol2>
Set how a peek timeout or PeekInterrupt is handled, using a
static PeekPolicy or a PeekPolicyProvider that selects one per input.
Defaults to PeekPolicy::FAIL_OPEN, under which a cutoff
treats the input as not PROXY.
pub fn with_strictness(self, value: HaProxyStrictness) -> HaProxyLayer<Pol>
pub fn with_strictness(self, value: HaProxyStrictness) -> HaProxyLayer<Pol>
Override the strictness configuration applied to incoming PROXY headers.
pub fn set_strictness(
&mut self,
value: HaProxyStrictness,
) -> &mut HaProxyLayer<Pol>
pub fn set_strictness( &mut self, value: HaProxyStrictness, ) -> &mut HaProxyLayer<Pol>
Override the strictness configuration applied to incoming PROXY headers.
pub fn with_forwarded_selection_policy(
self,
policy: ForwardedSelectionPolicy,
) -> HaProxyLayer<Pol>
pub fn with_forwarded_selection_policy( self, policy: ForwardedSelectionPolicy, ) -> HaProxyLayer<Pol>
Install this ForwardedSelectionPolicy, which selects the client element of the
Forwarded chain, overwriting one set already unless keeping existing ones.
pub fn set_forwarded_selection_policy(
&mut self,
policy: ForwardedSelectionPolicy,
) -> &mut HaProxyLayer<Pol>
pub fn set_forwarded_selection_policy( &mut self, policy: ForwardedSelectionPolicy, ) -> &mut HaProxyLayer<Pol>
Install this ForwardedSelectionPolicy, which selects the client element of the
Forwarded chain, overwriting one set already unless keeping existing ones.
pub fn with_keep_existing_selection_policy(
self,
keep: bool,
) -> HaProxyLayer<Pol>
pub fn with_keep_existing_selection_policy( self, keep: bool, ) -> HaProxyLayer<Pol>
Install the ForwardedSelectionPolicy only where none is set yet.
pub fn set_keep_existing_selection_policy(
&mut self,
keep: bool,
) -> &mut HaProxyLayer<Pol>
pub fn set_keep_existing_selection_policy( &mut self, keep: bool, ) -> &mut HaProxyLayer<Pol>
Install the ForwardedSelectionPolicy only where none is set yet.
Trait Implementations§
§impl<Pol> Clone for HaProxyLayer<Pol>where
Pol: Clone,
impl<Pol> Clone for HaProxyLayer<Pol>where
Pol: Clone,
§fn clone(&self) -> HaProxyLayer<Pol>
fn clone(&self) -> HaProxyLayer<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<Pol> Debug for HaProxyLayer<Pol>where
Pol: Debug,
impl<Pol> Debug for HaProxyLayer<Pol>where
Pol: Debug,
§impl Default for HaProxyLayer
impl Default for HaProxyLayer
§fn default() -> HaProxyLayer
fn default() -> HaProxyLayer
§impl<S, Pol> Layer<S> for HaProxyLayer<Pol>where
Pol: Clone,
impl<S, Pol> Layer<S> for HaProxyLayer<Pol>where
Pol: Clone,
§type Service = HaProxyService<S, Pol>
type Service = HaProxyService<S, Pol>
§fn layer(&self, inner: S) -> <HaProxyLayer<Pol> as Layer<S>>::Service
fn layer(&self, inner: S) -> <HaProxyLayer<Pol> as Layer<S>>::Service
§fn into_layer(self, inner: S) -> Self::Service
fn into_layer(self, inner: S) -> Self::Service
layer but consuming self after the service was created. Read moreAuto Trait Implementations§
impl<Pol> Forget for HaProxyLayer<Pol>
impl<Pol> Freeze for HaProxyLayer<Pol>where
Pol: Freeze,
impl<Pol> RefUnwindSafe for HaProxyLayer<Pol>where
Pol: RefUnwindSafe,
impl<Pol> Send for HaProxyLayer<Pol>where
Pol: Send,
impl<Pol> Sync for HaProxyLayer<Pol>where
Pol: Sync,
impl<Pol> Unpin for HaProxyLayer<Pol>where
Pol: Unpin,
impl<Pol> UnsafeUnpin for HaProxyLayer<Pol>where
Pol: UnsafeUnpin,
impl<Pol> UnwindSafe for HaProxyLayer<Pol>where
Pol: UnwindSafe,
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