ipinrange
v0.0.1
Published
check if an ip is within range
Downloads
2
Readme
ipinrange
Allows to check if an ip is within a range:
var ipinrange = require("ipinrange");
var inRange = ipinrange.isInRange("192.168.10.1", "192.168.10.5", "192.168.10.2");
console.log("192.168.10.1 - 192.168.10.5 ? 192.168.10.2 -> ", inRange);
var notinRange = ipinrange.isInRange("192.168.10.1", "192.168.10.5", 192.168.10.9");
console.log("192.168.10.1 - 192.168.10.5 ? 192.168.10.9 -> ", notinRange);
And Ason allows, to get the start and end of an cidr address:
var cidr = "192.168.10.1/24";
var inicioFim = ipinrange.getStartIpAndEndFromCidr(cidr);
console.log("Start and End for ", cidr, inicioFim);
Credits: https://github.com/vasturiano/ip.js https://github.com/rs/node-netmask