nodejs-dns-over-https-tangerine icon indicating copy to clipboard operation
nodejs-dns-over-https-tangerine copied to clipboard

[feat] parallel resolution

Open Kikobeats opened this issue 7 months ago • 6 comments
trafficstars

Describe the feature

I recently installed AdGuard Home on my local network and enabled the following feature:

Image

It's great because you no longer have to worry about whether your DNS is fast or not – simply the fastest will be used.

I was wondering if Tangerine can implement this way of DNS resolution.

Checking the Tangerine source code, I can see requests are resolved in series, so the server index in the array is important:

https://github.com/forwardemail/nodejs-dns-over-https-tangerine/blob/42da3ee7c4e9f1200233f2acdb47f8c9bf01d7d4/index.js#L1112

This parallel resolution could be achievable using p-any; it also supports cancellation, so as soon as the first promise for getting the DNS resolution is resolved, the rest will be cancelled, preventing a waste of resources.

WDYT?

Kikobeats avatar Mar 30 '25 18:03 Kikobeats