Motivation
Filter HTTP remote address through a list of CIDR (with proxies white list support)
API
const allow = require('httpaddr');
var server = http.createServer(function(req, res) {
var allowed = allow(req, ["127.0.0.1/32"]);
console.log("Allow only from localhost");
var allowedproxy = allow(req, ["127.0.0.1/32"], ["someproxies/24"]);
console.log("Allow only from allowedproxy");
});
server.listen(8080);
Notes
CIDR are filtered through the ipaddr.js module