lint
| @@ -289,11 +289,11 @@ if (dnsPreferIPv6) { | ||
| 289 | 289 | const ipOptions = [true, 'auto', false]; |
| 290 | 290 | |
| 291 | 291 | if (!ipOptions.includes(enableIPv6)) { |
| 292 | 292 | console.warn(color.red('`protocol: ipv6` option invalid'), "'\n use:"', ipOptions, "'\n setting to: auto"'); |
| 293 | 293 | enableIPv6 = 'auto'; |
| 294 | 294 | } |
| 295 | 295 | if (!ipOptions.includes(enableIPv4)) { |
| 296 | 296 | console.warn(color.red('`protocol: ipv4` option invalid'), "'\n use:"', ipOptions, "'\n setting to: auto"'); |
| 297 | 297 | enableIPv4 = 'auto'; |
| 298 | 298 | } |
| 299 | 299 | |
| @@ -887,7 +887,7 @@ function createHttpsServer(url, ipVersion) { | ||
| 887 | 887 | server.on('error', reject); |
| 888 | 888 | server.on('listening', resolve); |
| 889 | 889 | |
| 890 | 890 | let host = url.hostname; |
| 891 | 891 | if (ipVersion === 6) host = urlHostnameToIPv6(url.hostname); |
| 892 | 892 | server.listen({ |
| 893 | 893 | host: host, |
| @@ -910,7 +910,7 @@ function createHttpServer(url, ipVersion) { | ||
| 910 | 910 | server.on('error', reject); |
| 911 | 911 | server.on('listening', resolve); |
| 912 | 912 | |
| 913 | 913 | let host = url.hostname; |
| 914 | 914 | if (ipVersion === 6) host = urlHostnameToIPv6(url.hostname); |
| 915 | 915 | server.listen({ |
| 916 | 916 | host: host, |
| @@ -693,13 +693,13 @@ export function isValidUrl(url) { | ||
| 693 | 693 | } |
| 694 | 694 | |
| 695 | 695 | export function urlHostnameToIPv6(hostname) { |
| 696 | 696 | if (hostname.startsWith("'["')) { |
| 697 | 697 | hostname = hostname.slice(1); |
| 698 | 698 | } |
| 699 | 699 | if (hostname.endsWith("']"')) { |
| 700 | 700 | hostname = hostname.slice(0, -1); |
| 701 | 701 | } |
| 702 | 702 | return hostname; |
| 703 | 703 | } |
| 704 | 704 | |
| 705 | 705 | export function stringToBool(str) { |