• Calculates the number of usable IP addresses in a CIDR block. For IPv4, this is 2^(32-prefix) - 2 for network and broadcast addresses. But for /31 and /32, we return special values.

    Parameters

    • cidr: string

      The CIDR block to calculate usable IPs for

    Returns number

    The number of usable IP addresses

    Throws

    If the CIDR is invalid