Function: isPublicAddress()
isPublicAddress(
address):boolean
Defined in: packages/agentos/src/cognition/memory/io/ingestion/guardedFetch.ts:156
True when address, an IPv4 or IPv6 address as text, is a public unicast
address: not unspecified, loopback, private, carrier-grade NAT, link-local,
unique-local, site-local, multicast, documentation, benchmarking or
otherwise reserved, and, for an IPv6 address that carries an IPv4 one
(IPv4-mapped, IPv4-compatible, NAT64, 6to4), not one whose IPv4 address is
any of those. Text that is not an IP address is not public. It is the rule
guardedFetch applies to every address a host resolves to, the same
rule as isPublicNetworkAddress in @framers/agentos/io/media/images,
which it calls.
Parameters
address
string
Returns
boolean
Example
isPublicAddress('8.8.8.8'); // true
isPublicAddress('169.254.169.254'); // false: link-local, where cloud metadata services answer
isPublicAddress('::ffff:10.0.0.1'); // false: a private IPv4 address inside IPv6