Struct HaProxyService
pub struct HaProxyService<S, Pol = PeekPolicy> { /* private fields */ }haproxy only.Expand description
Service to decode the HaProxy Protocol
This service will decode the HaProxy Protocol header and pass the decoded information to the inner service.
Implementations§
§impl<S> HaProxyService<S>
impl<S> HaProxyService<S>
pub const fn new(inner: S) -> HaProxyService<S>
pub const fn new(inner: S) -> HaProxyService<S>
Create a new HaProxyService with the given inner service.
§impl<S, Pol> HaProxyService<S, Pol>
impl<S, Pol> HaProxyService<S, Pol>
pub fn into_inner(self) -> S
pub fn into_inner(self) -> S
Consumes self, returning the underlying service.
pub fn with_peek(self, value: bool) -> HaProxyService<S, Pol>
pub fn with_peek(self, value: bool) -> HaProxyService<S, Pol>
Instruct HaProxyService 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 HaProxyService<S, Pol>
pub fn set_peek(&mut self, value: bool) -> &mut HaProxyService<S, Pol>
Instruct HaProxyService 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>,
) -> HaProxyService<S, Pol>
pub fn maybe_with_peek_timeout( self, peek_timeout: Option<Duration>, ) -> HaProxyService<S, 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 HaProxyService<S, Pol>
pub fn maybe_set_peek_timeout( &mut self, peek_timeout: Option<Duration>, ) -> &mut HaProxyService<S, 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) -> HaProxyService<S, Pol>
pub fn with_peek_timeout(self, peek_timeout: Duration) -> HaProxyService<S, 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 HaProxyService<S, Pol>
pub fn set_peek_timeout( &mut self, peek_timeout: Duration, ) -> &mut HaProxyService<S, 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) -> HaProxyService<S, Pol>
pub fn without_peek_timeout(self) -> HaProxyService<S, 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 HaProxyService<S, Pol>
pub fn unset_peek_timeout(&mut self) -> &mut HaProxyService<S, 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,
) -> HaProxyService<S, Pol2>
pub fn with_peek_policy<Pol2>( self, peek_policy: Pol2, ) -> HaProxyService<S, 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) -> HaProxyService<S, Pol>
pub fn with_strictness(self, value: HaProxyStrictness) -> HaProxyService<S, Pol>
Override the strictness configuration applied to incoming PROXY headers.
pub fn set_strictness(
&mut self,
value: HaProxyStrictness,
) -> &mut HaProxyService<S, Pol>
pub fn set_strictness( &mut self, value: HaProxyStrictness, ) -> &mut HaProxyService<S, Pol>
Override the strictness configuration applied to incoming PROXY headers.
pub fn with_forwarded_selection_policy(
self,
policy: ForwardedSelectionPolicy,
) -> HaProxyService<S, Pol>
pub fn with_forwarded_selection_policy( self, policy: ForwardedSelectionPolicy, ) -> HaProxyService<S, 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 HaProxyService<S, Pol>
pub fn set_forwarded_selection_policy( &mut self, policy: ForwardedSelectionPolicy, ) -> &mut HaProxyService<S, 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,
) -> HaProxyService<S, Pol>
pub fn with_keep_existing_selection_policy( self, keep: bool, ) -> HaProxyService<S, Pol>
Install the ForwardedSelectionPolicy only where none is set yet.
pub fn set_keep_existing_selection_policy(
&mut self,
keep: bool,
) -> &mut HaProxyService<S, Pol>
pub fn set_keep_existing_selection_policy( &mut self, keep: bool, ) -> &mut HaProxyService<S, Pol>
Install the ForwardedSelectionPolicy only where none is set yet.
Trait Implementations§
§impl<S, Pol> Clone for HaProxyService<S, Pol>
impl<S, Pol> Clone for HaProxyService<S, Pol>
§fn clone(&self) -> HaProxyService<S, Pol>
fn clone(&self) -> HaProxyService<S, 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<S, Pol> Debug for HaProxyService<S, Pol>
impl<S, Pol> Debug for HaProxyService<S, Pol>
§impl<S, Pol> ExtensionsRef for HaProxyService<S, Pol>where
S: ExtensionsRef,
impl<S, Pol> ExtensionsRef for HaProxyService<S, Pol>where
S: ExtensionsRef,
§fn extensions(&self) -> &Extensions
fn extensions(&self) -> &Extensions
Extensions store§impl<S, IO, Pol> Service<IO> for HaProxyService<S, Pol>where
S: Service<PrefixedIo<HeapReader, IO>>,
<S as Service<PrefixedIo<HeapReader, IO>>>::Error: Into<Box<dyn Error + Sync + Send>>,
IO: Io + Unpin + ExtensionsRef,
Pol: PeekPolicyProvider<IO>,
impl<S, IO, Pol> Service<IO> for HaProxyService<S, Pol>where
S: Service<PrefixedIo<HeapReader, IO>>,
<S as Service<PrefixedIo<HeapReader, IO>>>::Error: Into<Box<dyn Error + Sync + Send>>,
IO: Io + Unpin + ExtensionsRef,
Pol: PeekPolicyProvider<IO>,
§type Output = <S as Service<PrefixedIo<HeapReader, IO>>>::Output
type Output = <S as Service<PrefixedIo<HeapReader, IO>>>::Output
§async fn serve(
&self,
stream: IO,
) -> Result<<HaProxyService<S, Pol> as Service<IO>>::Output, <HaProxyService<S, Pol> as Service<IO>>::Error>
async fn serve( &self, stream: IO, ) -> Result<<HaProxyService<S, Pol> as Service<IO>>::Output, <HaProxyService<S, Pol> as Service<IO>>::Error>
§fn boxed(self) -> BoxService<Input, Self::Output, Self::Error>
fn boxed(self) -> BoxService<Input, Self::Output, Self::Error>
Auto Trait Implementations§
impl<S, Pol> Forget for HaProxyService<S, Pol>
impl<S, Pol> Freeze for HaProxyService<S, Pol>
impl<S, Pol> RefUnwindSafe for HaProxyService<S, Pol>where
S: RefUnwindSafe,
Pol: RefUnwindSafe,
impl<S, Pol> Send for HaProxyService<S, Pol>
impl<S, Pol> Sync for HaProxyService<S, Pol>
impl<S, Pol> Unpin for HaProxyService<S, Pol>
impl<S, Pol> UnsafeUnpin for HaProxyService<S, Pol>where
S: UnsafeUnpin,
Pol: UnsafeUnpin,
impl<S, Pol> UnwindSafe for HaProxyService<S, Pol>where
S: UnwindSafe,
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<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 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