pub async fn parse_proxy_protocol(
stream: &mut TcpStream,
) -> Result<(Option<ProxyProtocolHeader>, Vec<u8>), ProxyError>Expand description
Parse the PROXY protocol header from the beginning of a TCP stream.
Returns the parsed header and a PrefixedStream that wraps the original
stream with any leftover bytes prepended so subsequent reads see the actual
application data.
If the stream does not start with a PROXY protocol header, returns None
and the stream is returned as-is inside a PrefixedStream with the peeked
bytes prepended.