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
@@ -151,6 +151,20 @@ put specific rules above general ones.
}
```
### Lua scripts
Xray 26.10.10 can hand routing and DNS to Lua. **Basics → Routing Script** takes the
path of a `.lua` file that defines `HandleRoute` (absolute, or relative to the Xray
`bin` folder); **DNS → Lua Script** takes one that defines `HandleDNSQuery`, and a
DNS server's **ID** is the name such a script picks it by.
<Callout type="warn">
A routing script replaces **every** routing rule, the panel's own `api` rule
included. Send the `api` inbound to the `api` outbound in your script, or traffic
statistics and live client changes stop. Xray does not start if the file is missing
or fails to load.
</Callout>
## Balancers
A **balancer** groups outbounds by a **selector** (tag prefixes, including the