first commit
This commit is contained in:
28
waf.lua
Normal file
28
waf.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
-- WAF统一入口模块
|
||||
-- 功能:集中管理所有安全检查(IP限流、UA限制等)
|
||||
|
||||
local _M = {}
|
||||
|
||||
local rate_limiter = require "modules.rate_limiter"
|
||||
local ua_limiter = require "modules.ua_limiter"
|
||||
|
||||
-- 执行所有安全检查
|
||||
-- 返回值:
|
||||
-- - true: 所有检查通过,允许访问
|
||||
-- - false: 某个检查失败,已返回错误响应
|
||||
function _M.check()
|
||||
-- IP频率限制检查
|
||||
if not rate_limiter.check_rate_limit() then
|
||||
return false
|
||||
end
|
||||
|
||||
-- User-Agent限制检查
|
||||
if not ua_limiter.check_ua_limit() then
|
||||
return false
|
||||
end
|
||||
|
||||
-- 所有检查通过
|
||||
return true
|
||||
end
|
||||
|
||||
return _M
|
||||
Reference in New Issue
Block a user