-
-
Notifications
You must be signed in to change notification settings - Fork 35.3k
dns.js not properly iterating through DNS array #21391
Copy link
Copy link
Closed
Labels
caresIssues and PRs related to the c-ares dependency or the cares_wrap binding.Issues and PRs related to the c-ares dependency or the cares_wrap binding.dnsIssues and PRs related to the dns subsystem.Issues and PRs related to the dns subsystem.docIssues and PRs related to the documentations.Issues and PRs related to the documentations.good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.
Metadata
Metadata
Assignees
Labels
caresIssues and PRs related to the c-ares dependency or the cares_wrap binding.Issues and PRs related to the c-ares dependency or the cares_wrap binding.dnsIssues and PRs related to the dns subsystem.Issues and PRs related to the dns subsystem.docIssues and PRs related to the documentations.Issues and PRs related to the documentations.good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.
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 dnsServer1andvar dnsServer2are two valid IP Address strings of two valid DNS servers, and given thatvar hostis a valid string which resolves to an IP ondnsServer1but not ondnsServer2, consider the following code:If the above is run, an
ENOTFOUNDerror will be produced andrecordswill beundefined. However, if the order of the array passed intodns.setServersis reversed, i.e.dns.setServers([dnsServer1, dnsServer2])and the same call to
dns.resolveis made, no error will be produced andrecordswill have resolved to a valid IP.Isn't
dns.resolvesupposed to check through each DNS IP set bydns.setServersuntil either one is able to resolvehostor 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.