deter:使用IP白名单黑名单将请求发送到默认路由

时间:2021-05-10 18:10:51
【文件属性】:
文件名称:deter:使用IP白名单黑名单将请求发送到默认路由
文件大小:10KB
文件格式:ZIP
更新时间:2021-05-10 18:10:51
JavaScript 阻止 使用IP白名单/黑名单将请求发送到默认路由 例子 const filterRoute = deter ( { whitelist : [ '127.0.0.1' , '172.16.18.0/24' , '::1' ] } , // ipv6! wow! onBadIp ) const server = http . createServer ( filterRoute ( onGoodIp ) ) server . listen ( 8080 ) function onBadIp ( req , res ) { res . statusCode = 403 res . end ( ) } function onGoodIp ( req , res ) { res . statusCode = 200 res . end ( `you're in!` ) }
【文件预览】:
deter-master
----.travis.yml(109B)
----.eslintrc(29B)
----package.json(1KB)
----test()
--------index.js(4KB)
----LICENSE(11KB)
----src()
--------index.js(1KB)
----.npmignore(526B)
----.gitignore(532B)
----README.md(3KB)

网友评论