(prefix: &[u8])
| 574 | } |
| 575 | |
| 576 | fn 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 | |
| 586 | fn looks_like_tls(prefix: &[u8]) -> bool { |
| 587 | prefix.len() >= 3 && prefix[0] == 0x16 && prefix[1] == 0x03 |
no test coverage detected