Expand description
Extracts the client IP address from request metadata.
Configuring http.ip_source installs ConfiguredIpSource in request
extensions and selects its address source. Loopback peers and peers in
TrustedPeerSubnets instead use the insecure header scan and ConnectInfo
fallback, because locally connected appservices and containerized bridges on
trusted private networks, including Docker networks, cannot spoof their peer
address at the IP layer.
Without a configured source, that same fallback preserves the default
behavior, including the socket-address fallback needed by UNIX sockets.
Re-exportsยง
use std::fmt;๐use std::net::IpAddr;๐use std::net::SocketAddr;๐use std::sync::Arc;๐use axum::extract::ConnectInfo;๐use axum::extract::FromRequestParts;๐use http::Extensions;๐use http::HeaderMap;๐use http::StatusCode;๐use http::request::Parts;๐use ipnet::IpNet;๐use tuwunel_core::config::IpSource;๐
Structsยง
- Client
Ip - Resolves the client IP address from request metadata.
- Configured
IpSource - Marks the explicitly configured client IP source.
- Rate
Limit Ip - Resolves an address for authentication rate limits.
- Trusted
Peer Subnets - Identifies trusted subnets whose TCP peers bypass secure IP extraction.
Functionsยง
- cloudfront_
viewer_ ๐address - insecure_
fallback ๐ - Leftmost header scan with
ConnectInfofallback. - leftmost_
forwarded ๐ - Parse
for=from the leftmost RFC 7239 stanza. Tolerates quoted values, bracketed IPv6, and an optional:portsuffix. - leftmost_
x_ ๐forwarded_ for - parse_
forwarded_ ๐for - peer_
is_ ๐trusted - rate_
limit_ ๐ip - rightmost_
forwarded ๐ - rightmost_
x_ ๐forwarded_ for - secure_
extract ๐ - single_
ip_ ๐header