Skip to main content

extract_sni_from_client_hello_record

Function extract_sni_from_client_hello_record 

pub fn extract_sni_from_client_hello_record(
    i: &[u8],
) -> Result<Option<Domain>, Box<dyn Error + Sync + Send>>
Available on crate feature tls only.
Expand description

Parse a ClientHello from the raw “wire” bytes to find the SNI Host value.

This function is optimised to find the SNI value and nothing else. Use parse_client_hello in case you need other content in the client hello, or the client hello as a whole.

This validates the encountered SNI payload and stops once it finds a host name. Other extensions are skipped, so a successful lookup does not establish a complete ClientHello observation. It returns None when no SNI host name is present.