Skip to main content

is_public

Function is_public 

Source
pub fn is_public(address: IpAddr) -> bool
Expand description

Whether address is on the public internet.

Everything the IANA special-purpose registries set aside is refused, as Mastodon’s PrivateAddressCheck refuses it. An IPv4-mapped IPv6 address is judged by the IPv4 address inside it, since that is where a packet to it ends up. The translation prefixes, NAT64 (64:ff9b::/96, 64:ff9b:1::/48) and 6to4 (2002::/16), are refused whatever they carry, as Mastodon refuses them: a server behind NAT64 allows the prefix with ClientConfig::allow_private, as a Mastodon server names it in ALLOWED_PRIVATE_ADDRESSES.