feat(中间层): 实现 Lua 插件驱动的安全代理
新增固定上游的 HTTP/SSE 转发、Lua 插件生命周期和请求级进程隔离。 实现逐插件域名与内网白名单、DNS 地址固定、超时取消和受控错误收尾。 提供三个 Lua 示例插件、配置与开发文档、Docker 和 APISIX 部署示例。 通过 65 项测试及静态检查,验证真实 TCP 流式转发、取消、资源限制和 Windows 命令行启动。
This commit is contained in:
commit
d0bb045134
28 files changed
+2764
No files matched your search
@@ -0,0 +1,15 @@
|
||||
local plugin = {}
|
||||
local config = {}
|
||||
function plugin.init(ctx, options) config = options end
|
||||
function plugin.on_request(ctx, request)
|
||||
local response = host.http.request({
|
||||
method='POST', url=config.url,
|
||||
headers={['content-type']='application/json'},
|
||||
body=request.body,
|
||||
})
|
||||
if response.status ~= 200 then return {action='block'} end
|
||||
local verdict = host.json.decode(response.body)
|
||||
if verdict.allow ~= true then return {action='block'} end
|
||||
return {action='pass'}
|
||||
end
|
||||
return plugin
|
||||
Reference in new issue
Block a user