Compare commits

...

1 Commits

Author SHA1 Message Date
fallenbagel
b4c03e63ae fix: set autoselectfamily to fix undici ipv6 issues 2024-10-18 06:24:17 +08:00
3 changed files with 17 additions and 0 deletions

View File

@@ -94,6 +94,7 @@
"swagger-ui-express": "4.6.2",
"swr": "2.2.5",
"typeorm": "0.3.12",
"undici": "^6.20.1",
"web-push": "3.5.0",
"winston": "3.8.2",
"winston-daily-rotate-file": "4.7.1",

9
pnpm-lock.yaml generated
View File

@@ -194,6 +194,9 @@ importers:
typeorm:
specifier: 0.3.12
version: 0.3.12(sqlite3@5.1.4(encoding@0.1.13))(ts-node@10.9.1(@swc/core@1.6.5(@swc/helpers@0.5.11))(@types/node@20.14.8)(typescript@4.9.5))
undici:
specifier: ^6.20.1
version: 6.20.1
web-push:
specifier: 3.5.0
version: 3.5.0
@@ -8768,6 +8771,10 @@ packages:
undici-types@5.26.5:
resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==}
undici@6.20.1:
resolution: {integrity: sha512-AjQF1QsmqfJys+LXfGTNum+qw4S88CojRInG/6t31W/1fk6G59s92bnAvGz5Cmur+kQv2SURXEvvudLmbrE8QA==}
engines: {node: '>=18.17'}
unicode-canonical-property-names-ecmascript@2.0.0:
resolution: {integrity: sha512-yY5PpDlfVIU5+y/BSCxAJRBIS1Zc2dDG3Ujq+sR0U+JjUevW2JhocOF+soROYDSaAezOzOKuyyixhD6mBknSmQ==}
engines: {node: '>=4'}
@@ -19486,6 +19493,8 @@ snapshots:
undici-types@5.26.5: {}
undici@6.20.1: {}
unicode-canonical-property-names-ecmascript@2.0.0: {}
unicode-emoji-utils@1.2.0:

View File

@@ -37,8 +37,15 @@ import dns from 'node:dns';
import net from 'node:net';
import path from 'path';
import swaggerUi from 'swagger-ui-express';
import { Agent, setGlobalDispatcher } from 'undici';
import YAML from 'yamljs';
// Set the global dispatcher to use autoSelectFamily
// attempt to fix ipv6 issues
setGlobalDispatcher(
new Agent({ connect: { timeout: 60_000, autoSelectFamily: true } })
);
if (process.env.forceIpv4First === 'true') {
dns.setDefaultResultOrder('ipv4first');
net.setDefaultAutoSelectFamily(false);