Skip to main content

Module proxy

Module proxy 

Source
Expand description

Trusted proxies and the ClientIp extractor.

Forwarding headers are honored only when the TCP peer is a trusted proxy, so a client cannot spoof its address by sending X-Forwarded-For itself.

Structs§

ClientIp
The real client address, resolved safely. Needs TrustedProxies as a request extension (App installs it) and connect info (App::serve does); without them it is the peer or None.
TrustedProxies
Set of proxy addresses (IPs and CIDR ranges) allowed to speak for the client. Empty trusts nobody.

Functions§

ip_bucket
Rate-limit bucket for a client: the address for IPv4 (and IPv4-mapped IPv6), the /64 prefix for IPv6, because one subscriber usually owns a whole /64 and could otherwise rotate addresses to dodge limits.