Skip to main content

peek_client_hello_from_input_with_policies

Function peek_client_hello_from_input_with_policies 

pub async fn peek_client_hello_from_input_with_policies<PeekableInput>(
    input: PeekableInput,
    options: PeekOptions,
    malformed_tls_policy: MalformedTlsPolicy,
    config: ClientHelloReassemblyConfig,
) -> Result<(<PeekableInput as PeekIoProvider>::Mapped<PrefixedIo<HeapReader, <PeekableInput as PeekIoProvider>::PeekIo>, PrefixedIo<ReplayReader, <PeekableInput as PeekIoProvider>::PeekEgressIo>>, Option<ClientHello>, ClientHelloPeekStatus), Error>
where PeekableInput: PeekIoProvider, <PeekableInput as PeekIoProvider>::PeekIo: Unpin, <PeekableInput as PeekIoProvider>::PeekEgressIo: Unpin,
Available on crate feature tls only.
Expand description

Peek a ClientHello with explicit PeekOptions, parse-failure, and reassembly policies.

Preserves every consumed wire byte, including record headers and any bytes read beyond the hello. A TLS content type (20 through 24) followed by the legacy major version 3 identifies TLS. Malformed headers, non-ClientHello messages, limit violations, and EOF within that prefix follow malformed_tls_policy: reject, or return the stream with no hello for fallback. The third return value records why inspection failed. Services insert this ClientHelloPeekStatus into their input’s extensions before dispatching. A lone content-type byte at EOF remains unclassified. Fallback stops peeking at the failure; it does not raise or disable the reassembly bounds. Cutoffs follow the PeekPolicy of options, shared by the header and body phases; read failures always return an error.