dns: minor.

This commit is contained in:
Christopher Jeffrey 2017-07-30 17:53:09 -07:00
parent 749cd9323f
commit ddda6c9dbd
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -20,7 +20,7 @@ const options = {
};
/**
* Resolve host (no getaddrinfo).
* Resolve host (async w/ libcares).
* @param {String} host
* @param {String?} proxy - Tor socks proxy.
* @returns {Promise}
@ -59,8 +59,6 @@ exports.lookup = function lookup(host, proxy) {
return socks.resolve(proxy, host);
return new Promise((resolve, reject) => {
const addrs = [];
dns.lookup(host, options, to((err, result) => {
if (err) {
reject(err);
@ -72,6 +70,8 @@ exports.lookup = function lookup(host, proxy) {
return;
}
const addrs = [];
for (const addr of result)
addrs.push(addr.address);