Skip to main content

new_proxy_protocol_header

Function new_proxy_protocol_header 

Source
pub fn new_proxy_protocol_header(
    version: ProxyProtocolVersion,
    addresses: Option<(SocketAddr, SocketAddr)>,
) -> Vec<u8> ⓘ
Expand description

The header a connection starts with.

addresses are where the client comes from and what of this proxy it came to. None is for a connection that is made for nobody, a health check: the backend is told to go by the connection itself (LOCAL in version 2; version 1 has UNKNOWN for it).

A client that is passed on without an address to give would be PROXY with no family in version 2, which is not written here: every listener of this proxy is a TCP one, and its clients have addresses.