Skip to main content

Module client_ip

Module client_ip 

Available on crate feature net only.
Expand description

Resolve the client IP of a request or connection from its extensions.

client_ip is the reusable resolver: it prefers the proxy-supplied Forwarded client IP (populated by forwarded-header / PROXY-protocol parsing) and falls back to the transport SocketInfo peer address.

ClientIp is method sugar (x.client_ip()). It is intentionally a plain trait — not bounded on ExtensionsRef and not blanket- implemented — so each request/input type opts in with the behaviour that fits it. Most types delegate to client_ip; a type that knows its peer directly could resolve it differently.

Traits§

ClientIp
Best-effort client-IP accessor, implemented per request/input type.

Functions§

client_ip
Best-effort client IP read from ext’s extensions: the Forwarded client IP when present, otherwise the SocketInfo peer IP, otherwise None.