Guess
Wire-protocol classifier for TCP / TLS streams. Feed the first bytes of a freshly accepted connection and get back one.
Features
- TLS ClientHello (parsed via
rustls::server::Acceptor; SNI and ALPN extracted) - HTTP/2 connection preface (RFC 7540 §3.5)
- HTTP/1 (request line with
HTTP/1.0orHTTP/1.1version marker) - Unknown (every detector ruled itself out — further reads will not change the outcome)
The cascade is three-state: when some detector wants more bytes
before committing, classify returns detected = None so the caller
knows to read more (up to MAX_PEEK_BYTES) and call again.
Example
use ;
#
Features
classify(default) — pulls inrustls(for the TLS parse) andmemchr(for the HTTP/1 scan), and exposesclassify. Disable to get only the result types — useful when a downstream crate wants to describe a peek without performing one:= { = "0.2", = false }
License
Released under the MIT License © 2026 Canmi