first commit

This commit is contained in:
2026-05-06 17:36:25 +08:00
commit c9c2fa8185
6 changed files with 707 additions and 0 deletions

28
waf.lua Normal file
View 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