Read or synthesize the inbound proxy protocol header. When `inbound_pp_enabled` is true, reads a PP header from the stream (e.g. from an upstream load balancer). When false, synthesizes one from the TCP peer address.
(
inbound: TcpStream,
config: &ProxyConfig,
)
| 30 | /// When `inbound_pp_enabled` is true, reads a PP header from the stream (e.g. from an upstream |
| 31 | /// load balancer). When false, synthesizes one from the TCP peer address. |
| 32 | pub(crate) async fn get_inbound_pp_header( |
| 33 | inbound: TcpStream, |
| 34 | config: &ProxyConfig, |
| 35 | ) -> Result<(TcpStream, ProxyHeader)> { |
| 36 | if config.inbound_pp_enabled { |
| 37 | read_proxy_header(inbound).await |
| 38 | } else { |
| 39 | let header = create_inbound_pp_header(&inbound); |
| 40 | Ok((inbound, header)) |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | pub struct DisplayAddr<'a>(pub &'a ProxyHeader); |
| 45 |
no test coverage detected