pub struct HaProxyService<S, P = Tcp, V = Two> { /* private fields */ }
Expand description
Service 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§
Source§impl<S> HaProxyService<S>
impl<S> HaProxyService<S>
Sourcepub fn tcp(inner: S) -> Self
pub fn tcp(inner: S) -> Self
Create a new HaProxyService
for the TCP protocol (default).
This is in the PROXY spec referred to as:
- TCP4 (for IPv4, v1)
- TCP6 (for IPv6, v1)
- Stream (v2)
Sourcepub fn v1(self) -> HaProxyService<S, Tcp, One>
pub fn v1(self) -> HaProxyService<S, 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.
Source§impl<S> HaProxyService<S, Udp>
impl<S> HaProxyService<S, Udp>
Sourcepub fn udp(inner: S) -> Self
pub fn udp(inner: S) -> Self
Create a new HaProxyService
for the UDP protocol,
instead of the default TCP protocol.
This is in the PROXY spec referred to as:
- Datagram (v2)
Source§impl<S, P> HaProxyService<S, P>
impl<S, P> HaProxyService<S, P>
Sourcepub fn payload(self, payload: Vec<u8>) -> Self
pub fn payload(self, payload: Vec<u8>) -> Self
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.
Sourcepub fn set_payload(&mut self, payload: Vec<u8>) -> &mut Self
pub fn set_payload(&mut self, payload: Vec<u8>) -> &mut Self
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§
Source§impl<S, P, State, Request, T> Service<State, Request> for HaProxyService<S, P, Two>
impl<S, P, State, Request, T> Service<State, Request> for HaProxyService<S, P, Two>
Source§impl<S, P, State, Request> Service<State, Request> for HaProxyService<S, P, One>
impl<S, P, State, Request> Service<State, Request> for HaProxyService<S, P, One>
Source§type Response = EstablishedClientConnection<<S as ConnectorService<State, Request>>::Connection, State, Request>
type Response = EstablishedClientConnection<<S as ConnectorService<State, Request>>::Connection, State, Request>
Auto Trait Implementations§
impl<S, P, V> Freeze for HaProxyService<S, P, V>
impl<S, P, V> RefUnwindSafe for HaProxyService<S, P, V>where
S: RefUnwindSafe,
V: RefUnwindSafe,
impl<S, P, V> Send for HaProxyService<S, P, V>
impl<S, P, V> Sync for HaProxyService<S, P, V>
impl<S, P, V> Unpin for HaProxyService<S, P, V>
impl<S, P, V> UnwindSafe for HaProxyService<S, P, V>where
S: UnwindSafe,
V: UnwindSafe,
Blanket Implementations§
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,
Source§impl<S, State, Request, Connection> ConnectorService<State, Request> for S
impl<S, State, Request, Connection> ConnectorService<State, Request> for S
Source§type Connection = Connection
type Connection = Connection
ConnectorService