Skip to main content

Module client_ip

Module client_ip 

Source
Expand description

Best-effort extraction of raw client IP assertions.

extract_client_ip uses CLIENT_IP_HEADERS, while extract_client_ip_with_headers lets callers choose the fields and their order explicitly using ClientIpHeader values. Both functions only inspect HTTP fields. They cannot authenticate the sender, so their results remain raw and untrusted. Applications must establish the relevant proxy or CDN trust boundary before using a result for authorization, abuse prevention, or rate limiting.

RFC 7239 standardizes Forwarded; X-Forwarded-For and the single-value provider/proxy fields are de facto conventions rather than IETF standards. No standard defines precedence between these different field names.

Enums§

ClientIpHeader
A supported client IP Header and its parsing rule.

Constants§

CLIENT_IP_HEADERS
The default Header lookup order used by extract_client_ip.

Functions§

extract_axum_peer_address
Extract the Axum transport peer stored in a request extension.
extract_axum_peer_ip
Extract the Axum socket peer IP stored in a request extension.
extract_client_ip
Extract a raw client IP assertion using the default field order.
extract_client_ip_with_headers
Extract a raw client IP assertion using caller-defined fields and order.
extract_peer_address
Return a transport peer address supplied out-of-band by an adapter.
extract_peer_ip
Return the IP address of a transport peer supplied out-of-band by an adapter.