MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / parses_v1_ipv4

Function parses_v1_ipv4

gateway/src/pp.rs:208–217  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

206
207 #[tokio::test]
208 async fn parses_v1_ipv4() {
209 // v1 is ASCII: "PROXY TCP4 <src> <dst> <sport> <dport>\r\n"
210 let header = b"PROXY TCP4 1.2.3.4 5.6.7.8 11111 22222\r\n";
211 let (_stream, parsed) = read_proxy_header(&header[..]).await.expect("v1 parse");
212 let (src, dst) = extract_v4(parsed);
213 assert_eq!(src.ip().octets(), [1, 2, 3, 4]);
214 assert_eq!(src.port(), 11111);
215 assert_eq!(dst.ip().octets(), [5, 6, 7, 8]);
216 assert_eq!(dst.port(), 22222);
217 }
218
219 #[tokio::test]
220 async fn parses_v2_ipv4() {

Callers

nothing calls this directly

Calls 2

read_proxy_headerFunction · 0.85
extract_v4Function · 0.85

Tested by

no test coverage detected