aboutsummaryrefslogtreecommitdiff
path: root/src/js/node/dns.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/js/node/dns.js')
-rw-r--r--src/js/node/dns.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/js/node/dns.js b/src/js/node/dns.js
index 2dc3895a2..bb59e702f 100644
--- a/src/js/node/dns.js
+++ b/src/js/node/dns.js
@@ -19,6 +19,19 @@ function lookup(domain, options, callback) {
options = { family: options };
}
+ const invalidDomainValues = [
+ undefined,
+ false,
+ null,
+ ""
+ ];
+
+ if(Number.isNaN(domain) || invalidDomainValues.some(value => domain === value)) {
+ console.warn(`DeprecationWarning: The provided hostname "${String(domain)}" is not a valid hostname, and is supported in the dns module solely for compatibility.`);
+ callback(null, null, 4);
+ return;
+ }
+
dns.lookup(domain, options).then(
res => {
res.sort((a, b) => a.family - b.family);