Connect middleware to define a whitelist/blacklist of IPv4 ranges.
In the terminal inside the project's folder.
npm install connect-purgatory --save
then in the server's file:
var http = require('http'), connect = require('connect'), purgatory = require('connect-purgatory'); var server = connect() .use(purgatory([ "184.108.40.206/32", "220.127.116.11/32", "18.104.22.168/32", "22.214.171.124/32", "126.96.36.199/27", "188.8.131.52/22" ]).bless()); http.createServer(server) .listen(3000);
thanks to @gnclmorais & @carlosdavidepto for helping understanding IP ranges and
for providing a model function to verify if an IP belong to a range.
Manage developer teams with varying permissions and multiple projects. Learn more about Private Packages and Organizations…
how? learn more