Skip to main content

Module client_ip

Module client_ip 

Source
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ยง

ClientIp
Resolves the client IP address from request metadata.
ConfiguredIpSource
Marks the explicitly configured client IP source.
RateLimitIp
Resolves an address for authentication rate limits.
TrustedPeerSubnets
Identifies trusted subnets whose TCP peers bypass secure IP extraction.

Functionsยง

cloudfront_viewer_address ๐Ÿ”’
insecure_fallback ๐Ÿ”’
Leftmost header scan with ConnectInfo fallback.
leftmost_forwarded ๐Ÿ”’
Parse for= from the leftmost RFC 7239 stanza. Tolerates quoted values, bracketed IPv6, and an optional :port suffix.
leftmost_x_forwarded_for ๐Ÿ”’
parse_forwarded_for ๐Ÿ”’
peer_is_trusted ๐Ÿ”’
rate_limit_ip ๐Ÿ”’
rightmost_forwarded ๐Ÿ”’
rightmost_x_forwarded_for ๐Ÿ”’
secure_extract ๐Ÿ”’
single_ip_header ๐Ÿ”’