Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Count the public IP addresses in each of the Azure DCs
var xml2js = require('xml2js');
var fs = require('fs');
var Netmask = require('netmask').Netmask;
// download from here
var xml = fs.readFileSync('ip-ranges.xml').toString();
xml2js.parseString(xml, function(err, json){
var output = {};
var total = 0;
output[x.$.Name] = 0;
var block = new Netmask(z.$.Subnet);
output[x.$.Name] += block.size;
total += block.size;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment