pub fn host_key(ip: IpAddr) -> HostKeyExpand description
The key a per-host ceiling counts the peer at ip under, and whether that
peer is local. A listener takes ip from the accepted connection’s
SocketAddr::ip.
An IPv4 peer is counted by its address and an IPv6 peer by its /64. An
IPv6 host is routed a whole /64, so a count per address would be a count
per suffix the host chooses: one host could hold every slot of a table while
staying under the ceiling of each address it connects from. An IPv4-mapped
IPv6 address — what an IPv4 client looks like to a dual-stack listener,
tcp://[::]:port — is counted as the IPv4 address it carries, so one host
is one key however it reaches the listener.
Loopback is judged on the canonical address and before the /64 is
taken. ::ffff:127.0.0.1 is loopback like 127.0.0.1, and ::2 is not,
though it shares ::1’s /64 and therefore its key.