cidrv6LastAddress(cidr: Cidrv6): bigint
Returns the last address of a CIDR block.
IPv6 has no broadcast address, so nothing is reserved at the top of a
block and this address is assignable. That is why there is deliberately
no cidrv6BroadcastAddress and no cidrv6LastUsableAddress to pair with
their IPv4 counterparts — the asymmetry is a fact about IPv6, not a gap.
Getting last address
Getting last address
import { assertEquals } from "@std/assert"; import { cidrv6LastAddress, parseCidrv6 } from "@hertzg/ip/cidrv6"; import { parseAddressv6 } from "@hertzg/ip/addressv6"; const cidr = parseCidrv6("2001:db8::/120"); assertEquals(cidrv6LastAddress(cidr), parseAddressv6("2001:db8::ff").address);
cidr: Cidrv6
The CIDR block