Fallback to dns.resolve4/6 on getaddrinfo failure

This commit is contained in:
Fedor Indutny 2023-03-21 17:43:55 -07:00 committed by GitHub
parent e4623e2ad5
commit 7e05893e1a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 68 additions and 0 deletions

View file

@ -28,6 +28,7 @@ import { formatAcceptLanguageHeader } from '../util/userLanguages';
import { toWebSafeBase64, fromWebSafeBase64 } from '../util/webSafeBase64';
import { getBasicAuth } from '../util/getBasicAuth';
import { isPnpEnabled } from '../util/isPnpEnabled';
import { lookupWithFallback } from '../util/dns';
import type { SocketStatus } from '../types/SocketStatus';
import { toLogFormat } from '../types/errors';
import { isPackIdValid, redactPackId } from '../types/Stickers';
@ -243,6 +244,7 @@ async function _promiseAjax(
agent: proxyUrl
? new ProxyAgent(proxyUrl)
: new Agent({
lookup: lookupWithFallback,
keepAlive: !options.disableSessionResumption,
maxCachedSessions: options.disableSessionResumption ? 0 : undefined,
}),