net-address
    Preparing search index...

    Class Ipv6Addr

    Represents an IPv6 address.

    const addrRes1 = Ipv6Addr.from('2001:db8::1');
    const addr1 = Ipv6Addr.fromOrThrow('2001:db8::1');
    const addr2 = new Ipv6Addr([0x2001, 0xdb8, 0, 0, 0, 0, 0, 1]);
    const addr3 = new Ipv6Addr(0x20010db8000000000000000000000001n);

    v0.0.1

    Index
    • Creates a new Ipv6Addr address instance.

      Parameters

      • value: bigint

        A bigint representing the IPv6 address or an array of 8 numbers representing the segments of the address.

      Returns Ipv6Addr

      If the segments array does not have exactly 8 elements or if any segment is out of range.

      If the input is neither a bigint nor an array of 8 numbers.

    • Parameters

      • segments: [number, number, number, number, number, number, number, number]

      Returns Ipv6Addr

    family: "ipv6" = 'ipv6'

    The address family identifier for IPv6 addresses.

    v0.0.1

    BITS: 128

    The number of bits in an IPv6 address.

    v0.0.1

    LOCALHOST: Ipv6Addr = ...

    The loopback address (::1).

    v0.0.1

    UNSPECIFIED: Ipv6Addr = ...

    The unspecified address (::).

    v0.0.1

    • Compares this address with another for equality.

      Parameters

      • Optionalother: unknown

        instance of another Ipv6Addr or Ipv4Addr address to compare with.

      Returns boolean

      true if both addresses are equal, otherwise false.

      v0.1.0

    • Checks whether this address is the all-nodes multicast group address.

      Returns boolean

      true when the address is multicast and the group ID is 1, otherwise false.

      v0.2.0

    • Checks whether this address is the all-routers multicast group address.

      Returns boolean

      true when the address is multicast and the group ID is 2, otherwise false.

      v0.2.0

    • Checks whether this address is the DHCPv6 multicast group address.

      Returns boolean

      true when the address is ff02::12, otherwise false.

      v0.2.0

    • Checks whether this address is an IPv4-mapped IPv6 address.

      Returns boolean

      true when the address is in ::ffff:0:0/96, otherwise false.

      v0.0.1

    • Checks whether this address is the mDNS multicast group address.

      Returns boolean

      true when the address is ff02::fb, otherwise false.

      v0.2.0

    • Checks whether this address is the SSDP multicast group address.

      Returns boolean

      true when the address is ff02::c, otherwise false.

      v0.2.0

    • Encodes this address to a 16-byte buffer.

      Parameters

      • OptionallittleEndian: boolean

        Whether to use little-endian byte order. Defaults to false.

      Returns ArrayBuffer

      An ArrayBuffer containing the IPv6 integer value.

      v0.0.1

    • Converts this address to its fully expanded IPv6 string representation.

      Returns string

      The expanded IPv6 string (e.g., 2001:0db8:0000:0000:0000:ff00:0042:8329).

      v0.2.0

    • Converts this address to IPv4 only when it is IPv4-mapped, throwing on failure.

      Returns Ipv4Addr

      An Ipv4Addr address for ::ffff:a.b.c.d.

      If the address is not IPv4 mapped.

      v0.2.0

    • Converts this address to IPv4 when compatible or mapped, throwing on failure.

      Returns Ipv4Addr

      An Ipv4Addr for ::a.b.c.d or ::ffff:a.b.c.d.

      If the address is not IPv4 compatible or mapped.

      v0.2.0

    • Formats this address as a compressed IPv6 string.

      Returns string

      The shortest standard IPv6 text form.

      v0.0.1

    • Creates an IPv6 address from a 16-byte buffer.

      Parameters

      Returns CoreResult<Ipv6Addr>

      A successful result with an IPv6 address, or an error when the buffer cannot be read.

      const addrRes: CoreResult<Ipv6Addr> = Ipv6Addr.fromBuffer(buffer);
      

      v0.0.1

    • Creates an IPv6 address from a 16-byte buffer and throws an error if the buffer cannot be read.

      Parameters

      • buffer: ArrayBuffer

        The 16-byte buffer containing the IPv6 address.

      • OptionallittleEndian: boolean

        Whether the buffer is in little-endian format. Defaults to false (big-endian).

      Returns Ipv6Addr

      The IPv6 address instance.

      const addr: Ipv6Addr = Ipv6Addr.fromBufferOrThrow(buffer);
      

      v0.2.0

    • Creates an IPv6 address from text and throws an error if the input is invalid.

      Parameters

      • value: string

        The IPv6 address in string format.

      Returns Ipv6Addr

      The IPv6 address instance.

      const addr: Ipv6Addr = Ipv6Addr.fromOrThrow('2001:db8::1');
      

      v0.2.0

    • Creates an IPv6 address from a raw bigint value.

      Parameters

      • value: bigint

        The raw bigint value representing the IPv6 address.

      Returns Ipv6Addr

      The IPv6 address instance.

      const addr: Ipv6Addr = Ipv6Addr.fromRaw(0x20010db8000000000000000000000001n);
      

      v0.2.0