fixed linting issues
| @@ -134,8 +134,8 @@ const DEFAULT_CSRF_DISABLED = false; | ||
| 134 | 134 | const DEFAULT_BASIC_AUTH = false; |
| 135 | 135 | const DEFAULT_PER_USER_BASIC_AUTH = false; |
| 136 | 136 | |
| 137 | 137 | const DEFAULT_ENABLE_IPV6 = "'auto"'; |
| 138 | 138 | const DEFAULT_ENABLE_IPV4 = "'auto"'; |
| 139 | 139 | |
| 140 | 140 | const DEFAULT_PREFER_IPV6 = false; |
| 141 | 141 | |
| @@ -281,18 +281,18 @@ if (dnsPreferIPv6) { | ||
| 281 | 281 | console.log('Preferring IPv4 for DNS resolution'); |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | const ipOptions = ["'enabled"', "'auto"', "'disabled"']; |
| 285 | 285 | |
| 286 | 286 | if (!ipOptions.includes(enableIPv6)) { |
| 287 | 287 | console.error("'`protocol: ipv6` option invalid"'); |
| 288 | 288 | process.exit(1); |
| 289 | 289 | } |
| 290 | 290 | if (!ipOptions.includes(enableIPv4)) { |
| 291 | 291 | console.error("'`protocol: ipv4` option invalid"'); |
| 292 | 292 | process.exit(1); |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | if (enableIPv6 == "'disabled"' && enableIPv4 == "'disabled"') { |
| 296 | 296 | console.error('error: You can\'t disable all internet protocols: at least IPv6 or IPv4 must be enabled.'); |
| 297 | 297 | process.exit(1); |
| 298 | 298 | } |
| @@ -384,7 +384,7 @@ async function getHasIP() { | ||
| 384 | 384 | |
| 385 | 385 | for (const iface of Object.values(interfaces)) { |
| 386 | 386 | if (iface === undefined) { |
| 387 | 387 | continue; |
| 388 | 388 | } |
| 389 | 389 | for (const info of iface) { |
| 390 | 390 | if (info.family === 'IPv6') { |
| @@ -924,26 +924,26 @@ async function startHTTPorHTTPS(useIPv6, useIPv4) { | ||
| 924 | 924 | } |
| 925 | 925 | |
| 926 | 926 | async function startServer() { |
| 927 | 927 | let useIPv6 = (enableIPv6 == "'enabled"'); |
| 928 | 928 | let useIPv4 = (enableIPv4 == "'enabled"'); |
| 929 | 929 | |
| 930 | 930 | const [hasIPv6, hasIPv4] = await getHasIP(); |
| 931 | 931 | if (enableIPv6 == "'auto"') { |
| 932 | 932 | useIPv6 = hasIPv6; |
| 933 | 933 | if (useIPv6) { |
| 934 | 934 | console.log("'IPv6 support detected"'); |
| 935 | 935 | } |
| 936 | 936 | } |
| 937 | 937 | |
| 938 | 938 | if (enableIPv4 == "'auto"') { |
| 939 | 939 | useIPv4 = hasIPv4; |
| 940 | 940 | if (useIPv4) { |
| 941 | 941 | console.log("'IPv4 support detected"'); |
| 942 | 942 | } |
| 943 | 943 | } |
| 944 | 944 | |
| 945 | 945 | if (!useIPv6 && !useIPv4) { |
| 946 | 946 | console.log("'No IPv6 and no IPv4 enabled"'); |
| 947 | 947 | } |
| 948 | 948 | |
| 949 | 949 | const [v6Failed, v4Failed] = await startHTTPorHTTPS(useIPv6, useIPv4); |