简体   繁体   中英

DNS lookup to specific server

I'd like to do a query in JavaScript to a specific dns server. I looked at node.js ( http://nodejs.org/api/dns.html ) but it just uses the local system configuration to do that. This is what I'd like to do in "dig" terms:

dig @dns.server.com fqdn.domain.com

There is a module on npm called native-dns that implements a DNS client and server in pure javascript.

Also there has been discussion off and on about adding support for custom DNS servers when querying with the built-in dns module. As far as I know nobody has started working on that yet (it may require changes in libuv too).

UPDATE: Modern versions of node now include this functionality via dns.setServers() . For example:

const dns = require('dns');
dns.setServers([ 'dns.example.org' ]);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM