Skip to main content

Module addr

Module addr 

Source
Expand description

Address classification.

Ipv4Addr::is_global is unstable in std, and the property we need is precise: can a host on the public internet route to this address? The trap is carrier-grade NAT space, 100.64.0.0/10 — it is not RFC 1918, so “is it private?” says no, yet nobody on the internet can reach it. A router under CGNAT will happily install a port mapping and report such an address; advertising it only burns a slot in the pilot’s candidate race.

Functions§

format_host
Wrap IPv6 literals in brackets so they can go in a URL authority.
is_global
Whether ip is reachable from the public internet.