1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
| /**
| * Module dependencies.
| */
|
| var dns = require('dns');
|
| /**
| * Module exports.
| */
|
| module.exports = isResolvable;
|
| isResolvable.async = true;
|
| /**
| * Tries to resolve the hostname. Returns true if succeeds.
| *
| * @param {String} host is the hostname from the URL.
| * @return {Boolean}
| */
|
| function isResolvable (host, fn) {
| var family = 4;
| dns.lookup(host, family, function (err, ip) {
| fn(null, !err);
| });
| }
|
|