Expand description
§modo::ip
Client IP extraction with trusted proxy support.
Always available (no feature flag required).
Provides:
ClientIp— axum extractor wrappingstd::net::IpAddrClientIpLayer— Tower layer that resolves the client IP and insertsClientIpinto request extensionsextract_client_ip— low-level resolution function (headers + trusted proxies + fallback)
§Quick start
use axum::{Router, routing::get};
use modo::{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
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.