0.0.1 • Published 7 years ago

ipinrange v0.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
7 years ago

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

0.0.1

7 years ago

0.0.0

7 years ago