Ipv6Interval
const Ipv6Interval: BoundIntervalType<bigint> & object;Defined in: interval-ip.ts:147
Interval over IPv6 addresses (discrete, ε = one address). Build with .ip() /
.cidr(); toString()/parse() use the compressed form. length() is a
number, so it loses precision for blocks larger than 2^53 addresses.
Type Declaration
Section titled “Type Declaration”| Name | Type | Description | Defined in |
|---|---|---|---|
cidr() |
(block) => Interval<bigint> |
The interval covering a CIDR block, e.g. "192.168.0.0/16" → [network, broadcast]. |
interval-ip.ts:69 |
ip() |
(addr) => bigint |
Parse a single address string to its comparable bigint value. |
interval-ip.ts:67 |
Example
Section titled “Example”import { Ipv6Interval } from "@xtandard/lib/ip";
const net = Ipv6Interval.cidr("2001:db8::/32");net.contains(Ipv6Interval.ip("2001:db8::1")); // truenet.encloses(Ipv6Interval.cidr("2001:db8:abcd::/48")); // truenet.toString(); // "[2001:db8::,2001:db8:ffff:ffff:ffff:ffff:ffff:ffff]"