Skip to content

Instantly share code, notes, and snippets.

@ishan-marikar
Created March 31, 2016 08:46
Show Gist options
  • Select an option

  • Save ishan-marikar/459abf3c240ae27d276807effc6da247 to your computer and use it in GitHub Desktop.

Select an option

Save ishan-marikar/459abf3c240ae27d276807effc6da247 to your computer and use it in GitHub Desktop.
'use strict';
let dns = require('dns'),
Promise = require('bluebird'),
resolve = Promise.promisify(dns.resolve),
_ = require('lodash');
function dnsRecords(addr) {
const rrtypes = ['A', 'MX'];
let promises = rrtypes.map(rrtype => resolve(addr, rrtype));
return Promise.all(promises)
.then((responses) => {
return _.zipObject(rrtypes, responses);
});
}
module.exports = dnsRecords;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment