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§
Source§impl HaProxyLayer
impl HaProxyLayer
Sourcepub fn tcp() -> Self
pub fn tcp() -> Self
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)
Sourcepub 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.
Source§impl HaProxyLayer<Udp>
impl HaProxyLayer<Udp>
Sourcepub fn udp() -> Self
pub fn udp() -> Self
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)
Source§impl<P> HaProxyLayer<P>
impl<P> HaProxyLayer<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<P: Clone, V: Clone> Clone for HaProxyLayer<P, V>
impl<P: Clone, V: Clone> Clone for HaProxyLayer<P, V>
Source§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