ipsentry

Lightweight Connect Middleware access control with ip addresses

npm install ipsentry
4 downloads in the last month

IPSentry

Build Status

ipsentry is a lightweight piece of Connect Middleware to provide access control based on a ip addresses.

Installation

via npm

npm install ipsentry

Usage

ipsentry expects an array of ip addresses. These are whitelisted for access.

If a client tries to connect from an invalid ip address a 403 response will be returned.

For connect

var connect = require('connect'),
  http = require('http')
  ipsentry = require('ipsentry');

function accessGranted(req, res){
  res.end('ipsentry says yes!');
}
var app = connect()
  .use(ipsentry(['127.0.0.1']))
  .use(accessGranted)

http.Server(app).listen(3000);

For express

var express = require('express'),
  ipsentry = require('ipsentry'),
  app = express();

app.use(ipsentry(['127.0.0.1']))

app.get('/', function(req, res){
  res.send('ipsentry says yes!');
});

app.listen(3000);
npm loves you