Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function validateCIDR (cidr) {
if (isCidrV6(cidr)) {
throw new Error('CIDR whitelist can only contain IPv4 addresses, ' + cidr + ' is IPv6')
}
if (!isCidrV4(cidr)) {
throw new Error('CIDR whitelist contains invalid CIDR entry: ' + cidr)
}
}