feat(xray): edit Lua DNS and routing scripts

xray-core 26.10.10 can hand DNS and routing to Lua: dns.script and
routing.script name a .lua file (absolute, or found next to the Xray
binary) that defines HandleDNSQuery / HandleRoute, and a DNS server's id
is how a DNS script picks it. The keys round-tripped through the JSON
template but had no field.

- DNS: a Lua Script field, and an ID field in the server modal;
- Basics: a Routing Script field beside the routing strategy;
- Routing: a warning above the rules while a script is set, since the
  core then routes only through the script and skips every rule, the
  panel's api rule included.

The descriptions say the script must still send the api inbound to the
api outbound, and that Xray will not start if the file is missing. An
empty field drops the key, because the core rejects an empty path.
This commit is contained in:
MHSanaei
2026-10-11 15:37:20 +02:00
parent 1c050f872a
commit b6c859f5b9
25 changed files with 338 additions and 30 deletions
@@ -140,6 +140,18 @@ Xray 配置中——而不会改动你已保存的模板。这是订阅一*池*
}
```
### Lua 脚本
Xray 26.10.10 可以把路由和 DNS 交给 Lua 处理。**基础配置 → 路由脚本** 填写定义了
`HandleRoute` 的 `.lua` 文件路径(绝对路径或相对于 Xray `bin` 目录);**DNS → Lua
脚本** 填写定义了 `HandleDNSQuery` 的文件,DNS 服务器的 **ID** 就是脚本选择它时使用的名称。
<Callout type="warn">
路由脚本会取代**全部**路由规则,包括面板自带的 `api` 规则。请在脚本中把 `api` 入站
发往 `api` 出站,否则流量统计和客户端变更的实时生效都会停止。文件不存在或加载失败时
Xray 无法启动。
</Callout>
## 均衡器
**均衡器**通过一个**选择器**(标签前缀,包括来自出站订阅的通配符池)将出站分组,