net-address
    Preparing search index...

    Class Ipv6Net

    Represents an IPv6 network.

    const addrRes = Ipv6Addr.from('2001:db8::1');
    const addr = Ipv6Addr.fromOrThrow('2001:db8::1');
    const network = Ipv6Net.fromAddr(addr, 64);

    v0.1.2

    Index
    family: "ipv6" = ...

    Address family of the network.

    v0.1.2

    size: number

    Size of the network (prefix length).

    v0.1.2

    • Assigns an address to the current network, effectively combining the network with the given address.

      Parameters

      • other: string | Ipv6Addr

        The other IPv6 address to combine with (e.g., ::100)

      Returns Ipv6Addr

      The combined IPv6 address as an Ipv6Addr instance. (e.g., combining 2001:db8::/64 with ::100 would result in 2001:db8::100)

      If the given address does not fit within the host portion of the network.

      v0.2.0

    • Checks if the given IPv6 address is contained within the network.

      Parameters

      Returns boolean

      true if the given address is contained within the network, otherwise false.

      v0.2.0

    • Checks if the current network contains the given child network.

      Parameters

      • child: Ipv6Net

        The child network to check for containment.

      Returns boolean

      true if the current network contains the child network, false otherwise.

      v0.2.0

    • Checks if the current network is equal to another network.

      Parameters

      • Optionalother: unknown

        The other network to compare with.

      Returns boolean

      true if the networks are equal, otherwise false.

      v0.2.0

    • Checks if the current network is a subnet of the given parent network.

      Parameters

      • parent: Ipv6Net

        The parent network to check against.

      Returns boolean

      true if the current network is a subnet of the parent network, false otherwise.

      v0.2.0

    • Returns the expanded string representation of the IPv6 network.

      Returns string

      The IPv6 network in expanded notation, e.g., 2001:0db8:0000:0000:0000:0000:0000:0001/64.

      v0.2.0

    • Gets the string representation of the IPv6 network.

      Returns string

      The IPv6 network as a string, e.g., 2001:db8::1/64.

      v0.2.0

    • Creates an instance of Ipv6Net from Ipv6Addr and network size, throwing an error if the size is invalid.

      Parameters

      • address: Ipv6Addr

        The interface address as an Ipv6Addr instance.

      • size: number

        The network size (prefix length) as a number.

      Returns Ipv6Net

      An instance of Ipv6Net.

      If the network size is not between 0 and 128.

      v0.2.0

    • Creates an instance of Ipv6Net from a string representation.

      Parameters

      • value: string

        The string representation of the IPv6 network, e.g., 2001:db8::/64 or full interface address with size.

      Returns Ipv6Net

      An instance of Ipv6Net.

      If the input string is not a valid IPv6 network representation.

      v0.2.0