JSPM

  • Created
  • Published
  • Downloads 30224
  • Score
    100M100P100Q148972F
  • License MIT

A light-weight IP address based filtering system

Package Exports

  • express-ipfilter

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (express-ipfilter) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

IP Filter: A light-weight IP address based filtering system

This package provides easy IP based access control. This can be achieved either by blacklisting certain IPs and whitelisting all others, or whitelisting certain IPs and blacklisting all others.

Build Status

Version

0.0.6

Installation

Recommended installation is with npm. To add node-ipfilter to your project, do:

npm install express-ipfilter

Usage with Express

Blacklisting certain IP addresses, while allowing all other IPs:

// Init dependencies
var express = require('express')
    , ipfilter = require('ipfilter')
    , app = express.createServer()
    ;

// Blacklist the following IPs
var ips = ['127.0.0.1'];

// Create the server
app.use(ipfilter(ips));
app.listen(3000);

Whitelisting certain IP addresses, while denying all other IPs:

// Init dependencies
var express = require('express')
    , ipfilter = require('ipfilter')
    , app = express.createServer()
    ;

// Blacklist the following IPs
var ips = ['127.0.0.1'];

// Create the server
app.use(ipfilter(ips, {mode: 'allow'}));
app.listen(3000);

Using CIDR subnet masks for ranges:

// Init dependencies
var express = require('express')
    , ipfilter = require('ipfilter')
    , app = express.createServer()
    ;

// Blacklist the following IPs
var ips = ['127.0.0.1/24'];

// Create the server
app.use(ipfilter(ips, {mode: 'allow'}));
app.listen(3000);

Changelog

0.0.6

  • Fixed a bug when using console output

0.0.5

  • Added ability to block by subnet mask (i.e. 127.0.0.1/24)
  • Added tests for cidr functionality

0.0.4

  • Add tests
  • Update docs
  • Refactor, and restyle

0.0.1

  • First revision

Credits

BaM Interactive - code.bamideas.com