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§
- Client
Ip - Best-effort client-IP accessor, implemented per request/input type.
Functions§
- client_
ip - Best-effort client IP read from
ext’s extensions: theForwardedclient IP when present, otherwise theSocketInfopeer IP, otherwiseNone.