Skip to content

@xtandard/lib/ip

IPv4/IPv6 address intervals: the Interval engine over IP addresses (peer ipaddr.js). Discrete; CIDR-aware. See docs/INTERVAL.md#ip-intervals.

import { … } from "@xtandard/lib/ip";
Name Summary
Ipv4Interval Instance type of Ipv4Interval.
Ipv6Interval Instance type of Ipv6Interval.
Name Summary
Ipv4Base The IPv4 interval class without the .ip()/.cidr() helpers. Internal: it is not exported and shows up in the API only as the instance type behind Ipv4Interval. Use Ipv4Interval, which is this same class plus the helpers.
Ipv4Interval Interval over IPv4 addresses (discrete, ε = one address). Values are the address as a bigint: convert with .ip("10.0.0.1"), or build a whole block with .cidr("10.0.0.0/8"). toString()/parse() use dotted form.
Ipv6Base The IPv6 interval class without the .ip()/.cidr() helpers. Internal: it is not exported and shows up in the API only as the instance type behind Ipv6Interval. Use Ipv6Interval, which is this same class plus the helpers.
Ipv6Interval 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.