ip-num
    Preparing search index...

    Class IPv6

    Represents an IPv6 number. A 128 bit number that is used to uniquely identify a device that is part of a computer network that uses the internet protocol for communication.

    Hierarchy (View Summary)

    Index

    Constructors

    • Constructor for an IPv6 number.

      Parameters

      • ipValue: string | bigint

        value to construct an IPv6 from. The given value can either be numeric or string. If a string is given then it needs to be in hexadecatet string notation

      • OptionalzoneId: string

      Returns IPv6

    Properties

    bitSize: number = 128

    The number of bits needed to represents the value of the IPv6 number

    hexadecatet: Hexadecatet[] = []

    An array of Hexadecatet's

    maximumBitSize: bigint = Validator.ONE_HUNDRED_AND_TWENTY_EIGHT_BIT_SIZE

    The maximum bit size (i.e. binary value) of the IPv6 number in BigInt

    separator: string = ":"

    The string character used to separate the individual hexadecatet when the IPv6 is rendered as strings

    type: IPNumType = IPNumType.IPv6

    The type of IP number. Value is one of the values of the IPNumType enum

    value: bigint

    The decimal value represented by the IPv6 number in BigInt

    zoneId: undefined | string

    The zone identifier of the IPv6 number

    Methods

    • Gets the kind/category of this IPv6 address.

      Returns the most specific kind that matches this address. The check order ensures correct classification when address ranges overlap:

      1. Unspecified (::)
      2. Loopback (::1)
      3. Multicast (ff00::/8)
      4. Documentation (2001:db8::/32 and 3fff::/20)
      5. IPv4-Mapped (::ffff:0:0/96)
      6. Discard-Only (100::/64)
      7. Link-Local (fe80::/10)
      8. Unique Local Address/Private (fc00::/7)
      9. Global Unicast (everything else, per RFC 4291)
      10. Unknown (fallback for reserved/unassigned ranges)

      According to RFC 4291, Global Unicast addresses are defined as "everything else" - any address that does not match the other specific address types.

      Returns IPv6AddressKind

      the kind of this IPv6 address

    • Gets the numeric value of an IP number as BigInt

      Returns bigint

      bigInt the numeric value of an IP number.

    • Checks if this IPv6 multicast address has an embedded Rendezvous Point (RP).

      For an embedded RP to be present, the R, P, and T flags must all be set to 1. The R flag (bit 9) indicates RP embedded, P flag (bit 10) indicates prefix-based, and T flag (bit 11) indicates transient address.

      Returns boolean

      true if embedded RP is present (R, P, T flags all set), false otherwise

      if this is not a multicast address

    • Checks if an IP number has a value greater than the present value

      Returns boolean

      true, if there is a value greater than the present value. Returns false otherwise.

    • Checks if an IP number has a value lesser than the present value

      Returns boolean

      true, if there is a value lesser than the present value. Returns false otherwise.

    • Checks if this IPv6 address is a discard-only address according to RFC 6666.

      Discard-only IPv6 address range:

      • 100::/64 (100:: to 100::ffff:ffff:ffff:ffff)

      Returns boolean

      true if this IPv6 address is discard-only, false otherwise

    • Checks if this IPv6 address is a global unicast address according to RFC 4291.

      According to RFC 4291, global unicast addresses are defined as "everything else" - any address that does not match the other specific address types (Unspecified, Loopback, Multicast, Link-Local, IPv4-Mapped, Discard-Only, Documentation, or Private).

      Note that this is not a strict "publicly routable" check: it does not consult the full IANA special-purpose address registry, so special-purpose ranges not covered by the checks above still return true.

      Returns boolean

      true if this IPv6 address is global unicast, false otherwise

    • Checks if the given IP number is greater than this current IP number

      Parameters

      Returns boolean

      true if the given IP number is greater than this current one. False otherwise.

    • Checks if the given IP number is greater than or equals to this current IP number

      Parameters

      Returns boolean

      {boolean} true if the given IP number is greater than or equals to this current one. False otherwise.

    • Checks if this IPv6 address is an IPv4-mapped IPv6 address according to RFC 4291.

      IPv4-mapped IPv6 addresses have a specific format:

      • First 80 bits: all zeros
      • Next 16 bits: 0xffff
      • Last 32 bits: IPv4 address

      This corresponds to the format ::ffff:x.x.x.x where x.x.x.x is an IPv4 address.

      Returns boolean

      true if this IPv6 address is IPv4-mapped, false otherwise

    • Checks if the given IP number is lesser than this current IP number

      Parameters

      Returns boolean

      true if the given IP number is less than this current one. False otherwise.

    • Checks if the given IP number is less than or equals to this current IP number

      Parameters

      Returns boolean

      true if the given IP number is less than or equals to this current one. False otherwise.

    • Checks if this IPv6 address is a link-local address according to RFC 4291.

      Link-local IPv6 address range:

      • fe80::/10 (fe80:: to febf:ffff:ffff:ffff:ffff:ffff:ffff:ffff)

      Returns boolean

      true if this IPv6 address is link-local, false otherwise

    • A string representation of the IPv6 number.

      Returns string

      The string representation of IPv6

    • A convenience method for creating an IPv6 by providing the decimal value of the IP number in BigInt

      Parameters

      • bigIntValue: bigint

        the decimal value of the IP number in BigInt

      Returns IPv6

      the IPv6 instance

    • A convenience method for creating an IPv6 from binary string

      Parameters

      • ipBinaryString: string

        the binary string representing the IPv6 number to be created

      Returns IPv6

      the IPv6 instance

    • A convenience method for creating an IPv4-Compatible IPv6 Address from an instance of IPv4

      Parameters

      • ipv4: IPv4

        to create an IPv4-Compatible IPv6 Address

      Returns IPv6

      the IPv4-Compatible IPv6 Address

    • A convenience method for creating an IPv4-Compatible IPv6 Address from a IPv4 represented in dot-decimal notation i.e. 127.0.0.1

      Parameters

      • ip4DotDecimalString: string

        string represented in a dot decimal string

      Returns IPv6

      the IPv4-Compatible IPv6 Address

    • Alias for IPv6.fromHexadecimalString

      Parameters

      • ipString: string

        the IP number in hexadecatet

      Returns IPv6

      the IPv6 instance