Struct HaProxyLayer
pub struct HaProxyLayer<P = Tcp, V = Two> { /* private fields */ }
Expand description
Layer to encode and write the HaProxy Protocol, as a client on the connected stream.
This connector should in most cases happen as the first thing after establishing the connection.
Implementations§
§impl HaProxyLayer
impl HaProxyLayer
pub fn tcp() -> HaProxyLayer
pub fn tcp() -> HaProxyLayer
Create a new HaProxyLayer
for the TCP protocol (default).
This is in the PROXY spec referred to as:
- TCP4 (for IPv4, v1)
- TCP6 (for IPv6, v1)
- Stream (v2)
pub fn v1(self) -> HaProxyLayer<Tcp, One>
pub fn v1(self) -> HaProxyLayer<Tcp, One>
Use version one of PROXY protocol, instead of the default version two.
Version one makes use of a less advanced text protocol, instead the more advanced binary v2 protocol.
Use this only if you have no control over a v1-only server.
§impl HaProxyLayer<Udp>
impl HaProxyLayer<Udp>
pub fn udp() -> HaProxyLayer<Udp>
pub fn udp() -> HaProxyLayer<Udp>
Create a new HaProxyLayer
for the UDP protocol,
instead of the default TCP protocol.
This is in the PROXY spec referred to as:
- Datagram (v2)
§impl<P> HaProxyLayer<P>
impl<P> HaProxyLayer<P>
pub fn with_payload(self, payload: impl Into<Bytes>) -> HaProxyLayer<P>
pub fn with_payload(self, payload: impl Into<Bytes>) -> HaProxyLayer<P>
Attach a custom bytes payload to the PROXY header.
NOTE this is only possible in Version two of the PROXY Protocol.
In case you downgrade this HaProxyLayer
to version one later
using Self::v1
this payload will be dropped.
pub fn set_payload(&mut self, payload: impl Into<Bytes>) -> &mut HaProxyLayer<P>
pub fn set_payload(&mut self, payload: impl Into<Bytes>) -> &mut HaProxyLayer<P>
Attach a custom bytes payload to the PROXY header.
NOTE this is only possible in Version two of the PROXY Protocol.
In case you downgrade this HaProxyLayer
to version one later
using Self::v1
this payload will be dropped.
Trait Implementations§
§impl<P, V> Clone for HaProxyLayer<P, V>
impl<P, V> Clone for HaProxyLayer<P, V>
§fn clone(&self) -> HaProxyLayer<P, V>
fn clone(&self) -> HaProxyLayer<P, V>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl<P, V> Debug for HaProxyLayer<P, V>
impl<P, V> Debug for HaProxyLayer<P, V>
§impl<S, P, V> Layer<S> for HaProxyLayer<P, V>where
V: Clone,
impl<S, P, V> Layer<S> for HaProxyLayer<P, V>where
V: Clone,
§type Service = HaProxyService<S, P, V>
type Service = HaProxyService<S, P, V>
§fn layer(&self, inner: S) -> <HaProxyLayer<P, V> as Layer<S>>::Service
fn layer(&self, inner: S) -> <HaProxyLayer<P, V> as Layer<S>>::Service
§fn into_layer(self, inner: S) -> <HaProxyLayer<P, V> as Layer<S>>::Service
fn into_layer(self, inner: S) -> <HaProxyLayer<P, V> as Layer<S>>::Service
layer
but consuming self after the service was created. Read moreAuto Trait Implementations§
impl<P, V> Freeze for HaProxyLayer<P, V>where
V: Freeze,
impl<P, V> RefUnwindSafe for HaProxyLayer<P, V>where
V: RefUnwindSafe,
impl<P, V> Send for HaProxyLayer<P, V>where
V: Send,
impl<P, V> Sync for HaProxyLayer<P, V>where
V: Sync,
impl<P, V> Unpin for HaProxyLayer<P, V>where
V: Unpin,
impl<P, V> UnwindSafe for HaProxyLayer<P, V>where
V: 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
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> 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