The IPv6 CIDR in string, object, or tuple format.
A new Ipv6Cidr instance.
import { ipv6 } from 'cidr-block';
const cidr1 = ipv6.cidr("2001:db8::/32");
const cidr2 = ipv6.cidr({ address: "2001:db8::", range: 32 });
const cidr3 = ipv6.cidr(["2001:db8::", 32]);
import { ipv6 } from 'cidr-block';
const cidr = ipv6.cidr("2001:db8::/32");
cidr.baseAddress().toString(); // "2001:db8::"
cidr.range(); // 32
cidr.netmask().toString(); // "ffff:ffff::"
cidr.addressCount(); // 79228162514264337593543950336n
import { ipv6 } from 'cidr-block';
const cidr = ipv6.cidr("2001:db8::/126");
cidr.getFirstUsableAddress()?.toString(); // "2001:db8::1"
cidr.getLastUsableAddress()?.toString(); // "2001:db8::2"
import { ipv6 } from 'cidr-block';
const cidr = ipv6.cidr("2001:db8::/32");
cidr.includes(ipv6.address("2001:db8::1")); // true
cidr.includes(ipv6.address("2001:db9::1")); // false
cidr.overlaps("2001:db8::/48"); // true
cidr.overlaps("2001:db9::/32"); // false
import { ipv6 } from 'cidr-block';
const cidr = ipv6.cidr("2001:db8::/32");
// Split into equal /34 subnets
cidr.subnet(34).map(s => s.toString());
// ["2001:db8::/34", "2001:db8:4000::/34", "2001:db8:8000::/34", "2001:db8:c000::/34"]
Creates a new Ipv6Cidr instance from the given literal. Valid formats include string, object, or tuple.