kernl API
    Preparing search index...

    Function isPrivateAddress

    • Tells whether a literal IP address belongs to a range the bridge never contacts.

      IPv4: this network, private, shared, loopback, link-local, IETF protocol assignments, benchmarking, multicast and reserved. IPv6 is parsed to its full 128 bits first, so every spelling of an address, including the hex form new URL normalises [::ffff:127.0.0.1] to (::ffff:7f00:1), is judged the same way: an address that embeds an IPv4 destination (mapped, compatible, translated, NAT64) is judged by that destination, and link-local, site-local, unique-local, multicast, discard, local NAT64, 6to4 and Teredo ranges are blocked outright. A zone suffix (%eth0) is ignored.

      Parameters

      • ip: string

        A literal IPv4 or IPv6 address, with or without brackets.

      Returns boolean

      True when the address is blocked; false for public addresses and for strings that are not an IP.

      isPrivateAddress('169.254.169.254'); // true
      isPrivateAddress('[::ffff:7f00:1]'); // true
      isPrivateAddress('93.184.216.34'); // false