ayonli / better-lookup

A better async DNS lookup function for Node.js that implements atomic cache operation.
MIT License
7 stars 3 forks source link

Ability to select custom DNS servers #5

Open NN-Binary opened 3 years ago

NN-Binary commented 3 years ago

Hi,

I would like to implement this cache but based on different DNS Servers. The reasoning is that my program uses Proxies from different locations (US, HK let say), however, I want the DNS records to be cached based on the location specified, I have DNS servers for US and HK, I want to be able to have an individual cache for each one of them as the results are different (geo-location).

How can I do that with better-lookup? Can I wrap the lookup function into sub-functions?

Thanks for the help!

ayonli commented 1 month ago

Sorry for the very late response.

I think we can't implement the functionality you're looking for, this module uses Node.js 'dns' module under the hood, which uses getaddrinfo function to resolve the DNS, and I don't see there is any option that we can specify custom DNS servers.

However, you could always set the DNS servers in your operating system.