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

Function extract_v4

gateway/src/pp.rs:185–205  ·  view source on GitHub ↗
(header: ProxyHeader)

Source from the content-addressed store, hash-verified

183 use proxy_protocol::{version1 as v1, version2 as v2, ProxyHeader};
184
185 fn extract_v4(header: ProxyHeader) -> (std::net::SocketAddrV4, std::net::SocketAddrV4) {
186 match header {
187 ProxyHeader::Version1 {
188 addresses:
189 v1::ProxyAddresses::Ipv4 {
190 source,
191 destination,
192 },
193 ..
194 } => (source, destination),
195 ProxyHeader::Version2 {
196 addresses:
197 v2::ProxyAddresses::Ipv4 {
198 source,
199 destination,
200 },
201 ..
202 } => (source, destination),
203 other => panic!("expected ipv4 header, got {other:?}"),
204 }
205 }
206
207 #[tokio::test]
208 async fn parses_v1_ipv4() {

Callers 2

parses_v1_ipv4Function · 0.85
parses_v2_ipv4Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected