浏览代码

Chore: disable IPv6 in fetch

SukkaW 1 年之前
父节点
当前提交
137426dc59
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      Build/lib/fetch-retry.ts

+ 6 - 0
Build/lib/fetch-retry.ts

@@ -26,6 +26,12 @@ if (!fs.existsSync(CACHE_DIR)) {
 const agent = new Agent({ allowH2: true });
 
 setGlobalDispatcher(agent.compose(
+  interceptors.dns({
+    // disable IPv6
+    dualStack: false,
+    affinity: 4
+    // TODO: proper cacheable-lookup, or even DoH
+  }),
   interceptors.retry({
     maxRetries: 5,
     minTimeout: 500, // The initial retry delay in milliseconds