Skip to main content

peek_client_hello_from_input_with_timeout_policy

Function peek_client_hello_from_input_with_timeout_policy 

pub async fn peek_client_hello_from_input_with_timeout_policy<PeekableInput>(
    input: PeekableInput,
    timeout: Option<Duration>,
    timeout_policy: PeekTimeoutPolicy,
) -> Result<(<PeekableInput as PeekIoProvider>::Mapped<PrefixedIo<HeapReader, <PeekableInput as PeekIoProvider>::PeekIo>>, Option<ClientHello>), Error>
where PeekableInput: PeekIoProvider, <PeekableInput as PeekIoProvider>::PeekIo: Unpin,
Available on crate feature tls only.
Expand description

Functional API to try to peek a TLS ClientHello with an explicit timeout policy, returning the stream with every consumed byte prefixed from memory.

A definitive non-TLS or malformed prefix returns Ok((input, None)) under either policy. An inconclusive timeout returns a timed-out std::io::Error when PeekTimeoutPolicy::FailClosed is selected.