Expand description
§modo::ip
Client IP extraction with trusted proxy support.
Provides:
ClientIp— axum extractor wrappingstd::net::IpAddrClientInfo— structured client metadata (IP, user-agent, etc.) inserted into request extensions byClientIpLayerClientIpLayer— Tower layer that resolves the client IP and insertsClientIp/ClientInfointo request extensionsextract_client_ip— low-level resolution function (headers + trusted proxies + fallback)
§Quick start
use axum::{Router, routing::get};
use modo::ip::{ClientIp, ClientIpLayer};
let app: Router = Router::new()
.route("/", get(handler))
.layer(ClientIpLayer::new());
async fn handler(ClientIp(ip): ClientIp) -> String {
ip.to_string()
}Structs§
- Client
Info - Client request context: IP address, user-agent, and fingerprint.
- Client
Ip - Resolved client IP address.
- Client
IpLayer - Tower layer that extracts the client IP address and inserts
ClientIpinto request extensions.
Functions§
- extract_
client_ ip - Resolve the real client IP from headers and connection info.