-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Description
- Version: 8.11.3
- Platform: Windows 10 Pro v1709
- Subsystem: dns
I'll preface this by saying that there's a significant chance I'm simply misunderstanding dns.setServers, but that being said, I believe I'm experiencing undesired functionality.
Given var dnsServer1 and var dnsServer2 are two valid IP Address strings of two valid DNS servers, and given that var host is a valid string which resolves to an IP on dnsServer1 but not on dnsServer2, consider the following code:
dns.setServers([dnsServer2, dnsServer1]);
dns.resolve(host, (err, records) => {
if (err) {
console.log(err);
} else {
console.log(records);
});
If the above is run, an ENOTFOUND error will be produced and records will be undefined. However, if the order of the array passed into dns.setServers is reversed, i.e.
dns.setServers([dnsServer1, dnsServer2])
and the same call to dns.resolve is made, no error will be produced and records will have resolved to a valid IP.
Isn't dns.resolve supposed to check through each DNS IP set by dns.setServers until either one is able to resolve host or none of them are able to do so? Here it instead seems the entire resolve operation fails as soon as the first DNS IP fails, and succeeds as soon as the first DNS IP succeeds.
I've tried to find more thorough documentation but couldn't find anything that said one way or the other.