Skip to main content

Module net

Module net 

Source
Expand description

Network vocabulary shared by every per-client limit.

Structs§

ClientKey
Key under which per-client state is held: an IPv4 address as /32, an IPv6 address as its /64 (one subscriber owns a whole /64, so per-address keys would be trivially bypassed).

Enums§

IpNet
An IP network address, either IPv4 or IPv6.

Constants§

MAX_TRUSTED_HOPS
Most trusted hops forwarded_client skips before giving up.
UNKNOWN_FORWARDED
The key of a request from a trusted proxy that names no usable client: no X-Forwarded-For, every entry a trusted proxy, more than MAX_TRUSTED_HOPS trusted entries, or a malformed entry reached on the walk. The unspecified address 0.0.0.0 is never a real peer, so it carries no ACL allow, no private-network trust and no per-client allowance of the proxy itself; all such requests share one bucket.

Functions§

client_key
Client key of ip. IPv4-mapped IPv6 addresses count as IPv4.
forwarded_client
The client address of a request that arrived from peer carrying the X-Forwarded-For header instances xff (in order), given the proxies listed in trusted.
is_trusted
Whether ip (IPv4-mapped IPv6 counted as IPv4) lies inside one of trusted.