I would like to implement a DNS client which should be able to resolve any valid domain public, private or otherwise (tor,i2p). What's the best way to achieve this?

I know that I need to pick a particular DNS server based on the TLD, for e.g, in order to resolve Tor I should have access to Tor network.

if it's .onion --> local (contact tor node)   
if it's .com --> (any public)   
if it's .tk --> (freenom) and so on ....

I'm looking for an idea on different possible and efficient ways to achieve this. The few options that I know of:

  1. bash script using dig, pointing to a specific dns server based on TLD
  2. BIND dns server config based on TLD
  3. writing a custom python program

Love to get your ideas. Please let me know if similar programs exist.

closed as off-topic by Teun Vink, Conor Mancone, Steffen Ullrich, schroeder Oct 21 at 19:35

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question does not appear to be about Information security within the scope defined in the help center." – Teun Vink, Conor Mancone, Steffen Ullrich, schroeder
If this question can be reworded to fit the rules in the help center, please edit the question.

  • This does not look like a security question but a programming question. – schroeder Oct 21 at 19:35

Many DNS Server implements already this logic. You can define multiple DNS server forwarder endpoints based on the domains changing the DNS server configuration file. Then you can use a standard DNS client to point to a DNS server with this configuration.

For instance here is described how to configure dnsmasq in order to forward DNS requeste to two external DNS servers based on the domain name.

  • 1
    Thank You, dnsmasq is the way to go !!!!, now i just need to find a way to resolve TOR and other private domains. – jamie Oct 21 at 14:46

Not the answer you're looking for? Browse other questions tagged or ask your own question.