allOnesMaskForIpAddress
allOnesMaskForIpAddress
Returns an all-ones (0xff) mask of the appropriate length for the given IP address string.
Returns 4 bytes for IPv4 and 16 bytes for IPv6.
Used to build name-constraint subnet masks that match a single host.
ts
function allOnesMaskForIpAddress(
value: string,
): Uint8ArrayParameters
value:string— IPv4 or IPv6 address string used to choose mask length.
Returns — An all-ones mask for the same address family.
Examples
ts
Array.from(allOnesMaskForIpAddress('127.0.0.1'));
// [255, 255, 255, 255]