| 93 | const allowPrivateLan = (env.ALLOW_PRIVATE_LAN ?? "1") !== "0"; |
| 94 | |
| 95 | function testHostname(host: string): boolean { |
| 96 | const h = host.toLowerCase(); |
| 97 | if (h === "localhost") return true; |
| 98 | if (isLoopbackV4(h)) return true; |
| 99 | if (LOOPBACK_V6.test(h)) return true; |
| 100 | if (MDNS.test(h)) return true; |
| 101 | if (allowPrivateLan) { |
| 102 | if (isPrivateOrLoopbackV4(h)) return true; |
| 103 | if (ULA_V6.test(h)) return true; |
| 104 | if (LINK_LOCAL_V6.test(h)) return true; |
| 105 | } |
| 106 | return matchExtra(h, extras); |
| 107 | } |
| 108 | |
| 109 | return { |
| 110 | test(rawHost: string | undefined): boolean { |