diff options
Diffstat (limited to 'src/routes/dev.rs')
| -rw-r--r-- | src/routes/dev.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/routes/dev.rs b/src/routes/dev.rs index 58f50c2..ef87986 100644 --- a/src/routes/dev.rs +++ b/src/routes/dev.rs @@ -50,7 +50,7 @@ struct TokenResponse { /// Whether the connection's peer is this machine: an address in /// 127.0.0.0/8 (127.0.x.x), the IPv6 loopback `::1`, or an IPv4-mapped /// 127.x. -fn is_local(peer: &SocketAddr) -> bool { +pub(crate) fn is_local(peer: &SocketAddr) -> bool { match peer.ip() { IpAddr::V4(ip) => ip.is_loopback(), IpAddr::V6(ip) => { @@ -63,7 +63,7 @@ fn is_local(peer: &SocketAddr) -> bool { /// these headers to anything, so they are never trusted to *establish* /// that a caller is local -- only used to refuse a request that claims to /// have come through a proxy. -fn via_proxy(headers: &HeaderMap) -> bool { +pub(crate) fn via_proxy(headers: &HeaderMap) -> bool { ["x-forwarded-for", "forwarded", "x-real-ip"] .into_iter() .any(|name| headers.contains_key(name)) |
