(address: string)
| 40 | * everything else |
| 41 | */ |
| 42 | export function isBlockedAddress(address: string): boolean { |
| 43 | const v = isIP(address) |
| 44 | if (v === 4) { |
| 45 | return isBlockedV4(address) |
| 46 | } |
| 47 | if (v === 6) { |
| 48 | return isBlockedV6(address) |
| 49 | } |
| 50 | // Not a valid IP literal — let the real DNS path handle it (this function |
| 51 | // is only called on results from dns.lookup, which always returns valid IPs) |
| 52 | return false |
| 53 | } |
| 54 | |
| 55 | function isBlockedV4(address: string): boolean { |
| 56 | const parts = address.split('.').map(Number) |
no test coverage detected