| 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 (!useIPv6enableIPv6 === 'auto' && !useIPv4enableIPv4 === 'auto') { |
| 946 | | - console.log('No IPv6 and no IPv4 enabled'); |
| 946 | + if (!hasIPv6 && !hasIPv4) { |
| 947 | + console.error('Both IPv6 and IPv4 are not detected'); |
| 948 | + process.exit(1) |
| 949 | + } |
| 950 | + } |
| 951 | + |
| 952 | + if (!useIPv6 && !useIPv6) { |
| 953 | + console.error('Both IPv6 and IPv4 are disabled,\nP.S. you should never see this error, at least at one point it was checked for before this'); |
| 954 | + process.exit(1) |
| 947 | 955 | } |
| 948 | 956 | |
| 949 | 957 | const [v6Failed, v4Failed] = await startHTTPorHTTPS(useIPv6, useIPv4); |