Don't shuffle dns addresses

This commit is contained in:
Fedor Indutny 2023-06-06 09:12:43 -07:00 committed by GitHub
parent b2f5febbf9
commit 82419f17dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,7 +7,6 @@ import type { LookupAddress } from 'dns';
import net from 'net';
import tls from 'tls';
import { callbackify, promisify } from 'util';
import { shuffle } from 'lodash';
import pTimeout from 'p-timeout';
import * as log from '../logging/log';
@ -55,8 +54,8 @@ export class Agent extends HTTPSAgent {
throw new Error(`Agent.createConnection: failed to resolve ${host}`);
}
const v4 = shuffle(addresses.filter(({ family }) => family === 4));
const v6 = shuffle(addresses.filter(({ family }) => family === 6));
const v4 = addresses.filter(({ family }) => family === 4);
const v6 = addresses.filter(({ family }) => family === 6);
// Interleave addresses for Happy Eyeballs, but keep the first address
// type from the DNS response first in the list.