Skip to main content

Module ip

Module ip 

Source
Expand description

§modo::ip

Client IP extraction with trusted proxy support.

Provides:

§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§

ClientInfo
Client request context: IP address, user-agent, and fingerprint.
ClientIp
Resolved client IP address.
ClientIpLayer
Tower layer that extracts the client IP address and inserts ClientIp into request extensions.

Functions§

extract_client_ip
Resolve the real client IP from headers and connection info.