How to use the dns.reverse function in dns

To help you get started, we’ve selected a few dns examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github graalvm / graaljs / test / disabled / test-dns.js View on Github external
return function(errr, stdout) {
    var expected = stdout.substr(0, stdout.length - 1).split('\n');

    var reversing = dns.reverse(myIp, function(error, domains, ttl, cname) {
      if (error) domains = [];
      cmpResults(expected, domains, ttl, cname);
    });
  }
}
github graalvm / graaljs / test / mjsunit / disabled / test-dns.js View on Github external
resolution.addCallback(function (addresses, ttl, cname) {
    puts("addresses: " + JSON.stringify(addresses));
    puts("ttl: " + JSON.stringify(ttl));
    puts("cname: " + JSON.stringify(cname));

    for (var i = 0; i < addresses.length; i++) {
      var a = addresses[i];
      var reversing = dns.reverse(a);
      reversing.addCallback( function (domains, ttl, cname) {
        puts("reverse for " + a + ": " + JSON.stringify(domains));
      });
      reversing.addErrback( function (code, msg) {
        puts("reverse for " + a + " failed: " + msg);
      });
    }
  });
github fcsonline / nodestalgia / app.js View on Github external
function reverse_addr(addr) {
    var e = new events.EventEmitter();
    dns.reverse(addr, function(err, domains) {
        if (err) {
            if (err.errno == dns.NOTFOUND)
                e.emit('response', addr, 'NOTFOUND');
            else
                e.emit('error', addr, err);
        } else
            e.emit('response', addr, domains);
    });
    return e;
}
github houshuang / madoko / web / server.js View on Github external
function dnsReverse( ip, callback ) {
  try {
    dns.reverse( ip, function(err,doms) {
      if (err) {
        doms = null;
        console.log("unable to resolve ip: " + err.toString() );
      }
      callback(doms);      
    });
  }
  catch(exn) {
    console.log("unable to resolve ip: " + exn.toString() );
    callback(null);
  }  
}
github thelounge / thelounge / src / server.js View on Github external
function reverseDnsLookup(ip, callback) {
	dns.reverse(ip, (err, hostnames) => {
		if (!err && hostnames.length) {
			return callback(hostnames[0]);
		}

		callback(ip);
	});
}

dns

A DNS Server with a REST API

MIT
Latest version published 10 years ago

Package Health Score

44 / 100
Full package analysis