File tree Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -297,15 +297,21 @@ class DnsResolver implements Resolver {
297
297
298
298
private async lookup ( hostname : string ) : Promise < TcpSubchannelAddress [ ] > {
299
299
if ( process . env [ DNS_RESOLUTION_ENV ] === 'true' ) {
300
- const records = await this . independentResolver . resolveAny ( hostname ) ;
301
- const addressList = records . filter ( addr => {
302
- addr . type === 'A' || addr . type === 'AAAA' ;
303
- } ) as unknown as { address : string } [ ] ;
300
+ const records = await Promise . allSettled ( [
301
+ this . independentResolver . resolve4 ( hostname ) ,
302
+ this . independentResolver . resolve6 ( hostname ) ,
303
+ ] ) ;
304
304
305
- return addressList . map ( addr => ( {
306
- host : addr . address ,
307
- port : + this . port ! ,
308
- } ) ) ;
305
+ return records
306
+ . reduce < string [ ] > ( ( acc , result ) => {
307
+ return result . status === 'fulfilled'
308
+ ? [ ...acc , ...result . value ]
309
+ : acc ;
310
+ } , [ ] )
311
+ . map ( addr => ( {
312
+ host : addr ,
313
+ port : + this . port ! ,
314
+ } ) ) ;
309
315
}
310
316
311
317
/* We lookup both address families here and then split them up later
You can’t perform that action at this time.
0 commit comments