diff --git a/lib/ip.js b/lib/ip.js index c1799a8..d8ccb07 100644 --- a/lib/ip.js +++ b/lib/ip.js @@ -414,3 +414,14 @@ ip.fromLong = function(ipl) { (ipl >> 8 & 255) + '.' + (ipl & 255) ); }; + + +ip.range = function(ip1, ip2) { + var ip1l = ip.toLong(ip1); + var ip2l = ip.toLong(ip2); + var ipList = []; + for (var i = Math.min(ip1l, ip2l); i <= Math.max(ip1l, ip2l); i++) { + ipList.push(i); + } + return ipList.map(ip.fromLong); +};