All Projects → nswbmw → Koa Ip

nswbmw / Koa Ip

Ip filter middleware for koa, support whitelist and blacklist.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Koa Ip

magento-2-security
Magento 2 Security extension FREE. Security extension gives store owners the ability to detect the IP addresses that are intentionally attacking their store at any given time. Therefore, they have timely measures to prevent this issue such as blocking those IP addresses or sending warning emails to store owners.
Stars: ✭ 40 (+8.11%)
Mutual labels:  whitelist, blacklist
black-mirror
Automatically maintained malicious host blacklists and false-positive whitelists.
Stars: ✭ 41 (+10.81%)
Mutual labels:  whitelist, blacklist
CyberSecurity-Box
Firewall-System based on OpenWRT or Pi-Hole with UnBound, TOR, optional Privoxy, opt. ntopng and opt. Configuration of the AVM FRITZ!Box with Presets for Security and Port-List. Please visit:
Stars: ✭ 20 (-45.95%)
Mutual labels:  whitelist, blacklist
accomplist
ACCOMPLIST - List Compiler
Stars: ✭ 51 (+37.84%)
Mutual labels:  whitelist, blacklist
Scriptsafe
a browser extension to bring security and privacy to chrome, firefox, and opera
Stars: ✭ 434 (+1072.97%)
Mutual labels:  blacklist, whitelist
jsCast
📻 An Audio Streaming Application written in JavaScript
Stars: ✭ 23 (-37.84%)
Mutual labels:  whitelist, blacklist
retrie
Efficient Trie-based regex unions for blacklist/whitelist filtering and one-pass mapping-based string replacing
Stars: ✭ 35 (-5.41%)
Mutual labels:  whitelist, blacklist
Blocker Database
A global domain based database for NoScript, uBlock, uMatrix & ScriptSafe
Stars: ✭ 127 (+243.24%)
Mutual labels:  blacklist, whitelist
Neodevhost
The Powerful Friendly Uptodate AD Blocking Hosts 最新强大而友善的去广告
Stars: ✭ 336 (+808.11%)
Mutual labels:  blacklist, whitelist
laravel-leaderboard
No description or website provided.
Stars: ✭ 39 (+5.41%)
Mutual labels:  whitelist, blacklist
domainos
A laravel package for blacklisting or whitelisting specific email providers or domains
Stars: ✭ 22 (-40.54%)
Mutual labels:  whitelist, blacklist
Spotify Adblock Linux
Spotify adblocker for Linux
Stars: ✭ 641 (+1632.43%)
Mutual labels:  blacklist, whitelist
koa-ip-filter
koa middleware to filter request IPs or custom ID with glob patterns, array, string, regexp or matcher function. Support custom 403 Forbidden message and custom ID.
Stars: ✭ 23 (-37.84%)
Mutual labels:  koa, ip
AntiBot
Lightweight BungeeCord plugin that aims to stop attacks on your server quickly and efficiently.
Stars: ✭ 42 (+13.51%)
Mutual labels:  whitelist, blacklist
Blackwhite
Domain, CIDR, IP black/white list, PAC generator
Stars: ✭ 251 (+578.38%)
Mutual labels:  blacklist, whitelist
unbound-dns-firewall
DNS-Firewall Python script for UNBOUND
Stars: ✭ 23 (-37.84%)
Mutual labels:  whitelist, blacklist
DNS-Sinkhole-Lists-A2
A DNS Sinkhole List for testing purposes. (not for use in production systems) - UUID: 0f90ca2c-4b0a-4fbe-b659-449ab30c4284
Stars: ✭ 19 (-48.65%)
Mutual labels:  whitelist, blacklist
Laravel Firewall
Web Application Firewall (WAF) package for Laravel
Stars: ✭ 544 (+1370.27%)
Mutual labels:  blacklist, whitelist
Usbguard
USBGuard is a software framework for implementing USB device authorization policies (what kind of USB devices are authorized) as well as method of use policies (how a USB device may interact with the system)
Stars: ✭ 668 (+1705.41%)
Mutual labels:  blacklist, whitelist
Deprecated
🚀 Framework for building universal web app and static website in Vue.js (beta)
Stars: ✭ 858 (+2218.92%)
Mutual labels:  koa

koa-ip

KoaJs Slack

koa-ip is a ip filter middleware for koa, support whitelist and blacklist.

Install

$ npm i koa-ip --save
or 
$ yarn add koa-ip

Usage

ip(String|RegExp)
ip(Array{String|RegExp})
ip({
  whitelist: Array{String|RegExp},
  blacklist: Array{String|RegExp},
  handler: async (ctx, next) => {}// handle blacklist ip
})

Examples

const Koa = require('koa')
const ip = require('koa-ip')

const app = new Koa()

app.use(ip('192.168.0.*'))// whitelist
// app.use(ip(['192.168.0.*', '8.8.8.[0-3]']))// whitelist
// app.use(ip({
//   whitelist: ['192.168.0.*', '8.8.8.[0-3]'],
//   blacklist: ['144.144.*']
// }))

app.listen(3000)

blacklist handler

const app = new Koa()
app.use((ctx, next) => {
  ctx.request.ip = '127.0.0.1'
  return next()
})
app.use(ip({
  blacklist: ['127.0.0.*'],
  handler: async (ctx, next) => {
    ctx.status = 403
  }
}))

app.use((ctx, next) => {
  ctx.status = 200
})

app.listen(3000)

NB: If missing blacklist handler, default ctx.status = 403.

More examples see test.

Test

$ npm test (coverage 100%)
or
$ yarn test (coverage 100%)

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].