Skip to main content

Module net

Module net 

Source
Expand description

Host address classification shared by the daemon and the CLI (ADR 001 § Node Discovery).

is_publishable decides whether an IP address is reachable from the public internet. route_public_ips reports the host’s own public addresses: the source address the kernel picks for its default route, per address family, kept only when it is publishable. A host with a public IP on its interface (a typical dedicated or cloud server) reports it; a host behind NAT (a home connection) reports none, because its route source is a private address.

Functions§

is_publishable
Whether ip is reachable from the public internet. A stable stand-in for the unstable IpAddr::is_global. An IPv4-mapped IPv6 address is judged as its IPv4 address.
quic_multiaddr
The QUIC multiaddr a node at ip listening on UDP port registers, e.g. /ip4/203.0.113.10/udp/4433/quic-v1.
route_public_ips
The host’s public IP addresses: for IPv4 and IPv6, the source address of the default route, kept when is_publishable. Empty on a host behind NAT or with no default route.