* Returns true if the IP is a loopback address (full 127.0.0.0/8 range, or ::1).
(ip: string)
| 102 | * Returns true if the IP is a loopback address (full 127.0.0.0/8 range, or ::1). |
| 103 | */ |
| 104 | function isLoopbackIP(ip: string): boolean { |
| 105 | try { |
| 106 | if (!ipaddr.isValid(ip)) return false |
| 107 | return ipaddr.process(ip).range() === 'loopback' |
| 108 | } catch { |
| 109 | return false |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | /** |
| 114 | * Returns true if the hostname is localhost or a loopback IP literal. |
no outgoing calls
no test coverage detected