Comparing version 0.0.2 to 0.1.0
var dns = require('dns'), | ||
net = require('net'), | ||
dnsLookup = dns.lookup; | ||
dnsLookup = dns.lookup, | ||
domains = []; | ||
@@ -10,13 +10,12 @@ | ||
dns.lookup = function(domain, family, callback) { | ||
dns.lookup = function(domain, options, callback) { | ||
var i; | ||
if (arguments.length === 2) { | ||
callback = family; | ||
family = 0; | ||
callback = options; | ||
options = {}; | ||
} | ||
else if (!family) { | ||
family = 0; | ||
} | ||
else { | ||
var family = (typeof(options) === 'object') ? options.family : options; | ||
if (family) { | ||
family = +family; | ||
@@ -36,3 +35,3 @@ if (family !== 4 && family !== 6) { | ||
return dnsLookup.call(this, domain, family, callback); | ||
return dnsLookup.call(this, domain, options, callback); | ||
}; | ||
@@ -101,2 +100,9 @@ | ||
/** | ||
* Remove all domains from the override list | ||
**/ | ||
function clear() { | ||
domains = []; | ||
} | ||
function createRegex(val) { | ||
@@ -114,3 +120,3 @@ var parts = val.split('*'), | ||
return new RegExp(val, 'i'); | ||
}; | ||
} | ||
@@ -120,3 +126,3 @@ | ||
return val.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); | ||
}; | ||
} | ||
@@ -126,3 +132,4 @@ module.exports = { | ||
remove: remove, | ||
clear: clear, | ||
domains: domains | ||
}; | ||
}; |
{ | ||
"name": "evil-dns", | ||
"version": "0.0.2", | ||
"version": "0.1.0", | ||
"description": "Override the IP address returned for one or more domains.", | ||
"main": "evil-dns.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"test": "mocha -R spec ./tests" | ||
}, | ||
"engines": { | ||
"node" : ">=0.12" | ||
}, | ||
"repository": { | ||
@@ -22,2 +25,10 @@ "type": "git", | ||
"author": "James Hight", | ||
"contributors": [ | ||
{ | ||
"name": "Martin Heidegger" | ||
}, | ||
{ | ||
"name": "Jacob Page" | ||
} | ||
], | ||
"licenses": [ | ||
@@ -32,3 +43,7 @@ { | ||
"url": "https://github.com/JamesHight/node-evil-dns/issues" | ||
}, | ||
"devDependencies": { | ||
"chai": "^2.1.0", | ||
"mocha": "^2.1.0" | ||
} | ||
} |
@@ -34,2 +34,5 @@ Evil DNS | ||
evilDns.remove(/^foo\.bar\..*$/i); | ||
```` | ||
// Remove all domain entries | ||
evilDns.clear(); | ||
```` |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
5635
7
136
2
38
2
4