Skip to main content

canonical

Function canonical 

Source
pub fn canonical(ip: IpAddr) -> IpAddr
Expand description

Normalizes an address into the form the kernel will actually route.

IPv4-mapped IPv6 (::ffff:a.b.c.d) becomes the IPv4 address it stands for. The deprecated IPv4-compatible range (::a.b.c.d, RFC 4291 ยง2.5.5.1) is left as IPv6 on purpose and handled by is_private, because mapping it to IPv4 would turn ::1 into 0.0.0.1 and quietly lose the loopback meaning.