pub struct HeaderBuilder { /* private fields */ }Expand description
Proxy Protocol header builder
Implementations§
Source§impl HeaderBuilder
impl HeaderBuilder
Sourcepub fn v2_proxy(source: SocketAddr, destination: SocketAddr) -> Self
pub fn v2_proxy(source: SocketAddr, destination: SocketAddr) -> Self
Create a v2 PROXY header with source and destination addresses
§Panics
Panics if source and destination have different address families (e.g. one IPv4 and one IPv6)
Sourcepub fn v1_proxy(source: SocketAddr, destination: SocketAddr) -> Self
pub fn v1_proxy(source: SocketAddr, destination: SocketAddr) -> Self
Create a v1 PROXY header with source and destination addresses
§Panics
Panics if source and destination have different address families
Sourcepub fn v1_unknown() -> Self
pub fn v1_unknown() -> Self
Create a v1 UNKNOWN header (no addresses)
Sourcepub fn v2_unix(
source: impl Into<Vec<u8>>,
destination: impl Into<Vec<u8>>,
protocol: TransportProtocol,
) -> Self
pub fn v2_unix( source: impl Into<Vec<u8>>, destination: impl Into<Vec<u8>>, protocol: TransportProtocol, ) -> Self
Create a v2 PROXY header for Unix domain sockets
Sourcepub fn with_transport_protocol(self, protocol: TransportProtocol) -> Self
pub fn with_transport_protocol(self, protocol: TransportProtocol) -> Self
Override the transport protocol (default is Stream for inet headers)
Add an authority TLV (0x02)
Sourcepub fn with_unique_id(self, id: impl Into<Vec<u8>>) -> Self
pub fn with_unique_id(self, id: impl Into<Vec<u8>>) -> Self
Add a unique ID TLV (0x05)
§Panics
Panics if id exceeds 128 bytes (the spec maximum for PP2_TYPE_UNIQUE_ID)
Sourcepub fn with_netns(self, netns: impl Into<String>) -> Self
pub fn with_netns(self, netns: impl Into<String>) -> Self
Add a NETNS TLV (0x30)
Sourcepub fn with_raw_tlv(self, type_byte: u8, value: impl Into<Vec<u8>>) -> Self
pub fn with_raw_tlv(self, type_byte: u8, value: impl Into<Vec<u8>>) -> Self
Add an arbitrary raw TLV
Sourcepub fn with_padding(self, len: u16) -> Self
pub fn with_padding(self, len: u16) -> Self
Add a NOOP padding TLV (0x04) with len zero bytes
Sourcepub fn with_crc32c(self) -> Self
pub fn with_crc32c(self) -> Self
Enable CRC32c checksum TLV; the checksum is computed at build time