package
design your own ipv4/6 networks
npm install networkerGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
design your own ipv4/6 networks
mostly educational - trying to teach myself about ip routing and most of the subnet calculators out there are pretty confusing
see CIDR
var networker = require('networker');
// i got a /48 from hurricane electric
var block = networker('2001:470:abcd::', 48);
// let's split that in half
var net49 = block.subnet(49);
console.log('subnets in a /49 coming from a /48:', net49.size()); // 2
// maybe we're designing a big company network and we want
// to reserve some addresses for internal vs external use
var internal = net49.network(0);
var external = net49.network(1);
// var moar = net49.network(2); // you can try this, but you will get a RangeError
// perhaps we'd like to split up our internal network into two smaller ones:
networker(address, [prefixLength, [networkSize=entireNetwork]]) create a new networkn.subnet(networkSize) split a network into subnets using networkSize bitsn.size() show the number of subnets in a networkn.network([index]) select a random subnet or pick one at a specific indexn.address([lowerIndex, [higherIndex]]) select a random subnet in the given rangen.toString() string representation of the network addressnone yet.. but the example above can be run by doing node example
WTFPL