koa-ip:用于koa的ip过滤器中间件,支持白名单和黑名单

时间:2021-02-03 14:50:39
【文件属性】:
文件名称:koa-ip:用于koa的ip过滤器中间件,支持白名单和黑名单
文件大小:4KB
文件格式:ZIP
更新时间:2021-02-03 14:50:39
koa whitelist blacklist ip KoaJavaScript koa-ip koa-ip是koa的IP过滤中间件,支持whitelist和blacklist 。 安装 $ npm i koa-ip --save or $ yarn add koa-ip 用法 ip ( String | RegExp ) ip ( Array { String | RegExp } ) ip ( { whitelist : Array { String | RegExp } , blacklist : Array { String |RegExp } , handler : async ( ctx , next ) => { } // handle blacklist ip } ) 例子 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]']))//
【文件预览】:
koa-ip-master
----index.js(1KB)
----package.json(963B)
----readme.md(1KB)
----__tests__()
--------koa-ip.test.js(4KB)
----.eslintrc.json(51B)
----index.d.ts(509B)
----.gitignore(142B)
----History.md(264B)

网友评论