NAT-Slipstream block
NAT-Slipstream block is a middleware that allows requests only from LAN (with the option of choosing exceptions).
Installation
This is a Node.js module available through the
npm registry. Installation is done using the
npm install
command:
$ npm install nat-ssb
Usage
Quick start
message: returned value when the request fail (optional)
callback: function that execute after the middleware with the ip as an argument (optional)
exceptions: array of public ip that can access although they are not in the lan (optional)
function
natSSB({message}, function callback(ip) {}, [exceptions])
Simple Usage
const express = require('express')
const { natSSB } = require('nat-ssb')
const ssb = natSSB({message: 'Access Denied'}, function callback(ip) {
console.log(`request from ip: ${ip}`);
}, [])
const app = express()
const port = 8080
app.use(ssb)
app.get('/', (req, res) => {
console.log(`Hello World`)
res.send(`Hello World`)
})
app.listen(port, () => {
console.log(`Server app listening`)
})