https://github.com/131/httpaddr
Filter http remote address through proxies & CIDR masks
https://github.com/131/httpaddr
Last synced: 8 months ago
JSON representation
Filter http remote address through proxies & CIDR masks
- Host: GitHub
- URL: https://github.com/131/httpaddr
- Owner: 131
- License: mit
- Created: 2018-05-28T13:59:26.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-28T14:54:15.000Z (about 8 years ago)
- Last Synced: 2025-05-15T05:35:06.264Z (about 1 year ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/131/httpaddr)
[](https://coveralls.io/github/131/httpaddr?branch=master)
[](https://www.npmjs.com/package/httpaddr)
[](http://opensource.org/licenses/MIT)
[](https://www.npmjs.com/package/eslint-plugin-ivs)
# 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](https://www.npmjs.com/package/ipaddr.js)
# Credits
* [131](https://github.com/131)