Skip to content

Commit

Permalink
Genereates a config file from the IP ranges.
Browse files Browse the repository at this point in the history
  • Loading branch information
keverw committed May 25, 2012
1 parent 6aa1f52 commit 1d120c8
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .npmignore
@@ -1,2 +1,3 @@
npm-debug.log
node_modules/
node_modules/
/generate_json.js
24 changes: 24 additions & 0 deletions generate_json.js
@@ -0,0 +1,24 @@
//CloudFlare IP Ranges from https://www.cloudflare.com/ips
var v4 = ['204.93.240.0/24', '204.93.177.0/24', '199.27.128.0/21', '173.245.48.0/20', '103.22.200.0/22', '141.101.64.0/18', '108.162.192.0/18', '190.93.240.0/20'];
var v6 = ['2400:cb00::/32', '2606:4700::/32', '2803:f800::/32'];

var fs = require('fs');

var ranges = {};

ranges.v4 = v4;
ranges.v6 = v6;

var file_contents = JSON.stringify(ranges);

fs.writeFile('./ranges.json', file_contents, 'utf8', function (err)
{
if (err)
{
console.log(err);
}
else
{
console.log('Wrote config file');
}
});
1 change: 1 addition & 0 deletions ranges.json
@@ -0,0 +1 @@
{"v4":["204.93.240.0/24","204.93.177.0/24","199.27.128.0/21","173.245.48.0/20","103.22.200.0/22","141.101.64.0/18","108.162.192.0/18","190.93.240.0/20"],"v6":["2400:cb00::/32","2606:4700::/32","2803:f800::/32"]}

0 comments on commit 1d120c8

Please sign in to comment.