Skip to content

isLocalNetworkAddress

isLocalNetworkAddress(address): boolean

Defined in: packages/core/src/dial-policy.ts:37

Whether dialing address would reach a host outside the public internet: a loopback, private, shared (CGNAT), link-local (including the 169.254.169.254 cloud metadata service), unique-local, unspecified, documentation, multicast or other IANA special-purpose IP address, a Unix socket, an IPv6 zone, or a DNS name that cannot be a public name (localhost, *.localhost, *.local, *.internal, *.home.arpa, a single label, or a numeric last label).

Only the first network component is checked, which for a circuit address is the relay. An address with no network component, such as /p2p/<relay>/p2p-circuit/p2p/<peer>, opens no new socket and is not local. DNS names are judged by their spelling: a public name that resolves to a private address is not detected.

Multiaddr

boolean