(stream: &TcpStream)
| 568 | } |
| 569 | |
| 570 | async fn classify_connection_protocol(stream: &TcpStream) -> std::io::Result<ConnectionProtocol> { |
| 571 | let mut prefix = [0_u8; 8]; |
| 572 | let read = stream.peek(&mut prefix).await?; |
| 573 | Ok(classify_initial_bytes(&prefix[..read])) |
| 574 | } |
| 575 | |
| 576 | fn classify_initial_bytes(prefix: &[u8]) -> ConnectionProtocol { |
| 577 | if looks_like_tls(prefix) { |
no test coverage detected