MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / classify_initial_bytes

Function classify_initial_bytes

crates/openshell-server/src/lib.rs:576–584  ·  view source on GitHub ↗
(prefix: &[u8])

Source from the content-addressed store, hash-verified

574}
575
576fn classify_initial_bytes(prefix: &[u8]) -> ConnectionProtocol {
577 if looks_like_tls(prefix) {
578 ConnectionProtocol::Tls
579 } else if looks_like_http(prefix) {
580 ConnectionProtocol::PlainHttp
581 } else {
582 ConnectionProtocol::Unknown
583 }
584}
585
586fn looks_like_tls(prefix: &[u8]) -> bool {
587 prefix.len() >= 3 && prefix[0] == 0x16 && prefix[1] == 0x03

Callers 1

Calls 2

looks_like_tlsFunction · 0.70
looks_like_httpFunction · 0.70

Tested by

no test coverage detected