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:
1 parent
1c050f872a
commit
b6c859f5b9
25 files changed
+338
-30
No files matched your search
@@ -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
|
||||
|
||||
@@ -152,6 +152,20 @@ Reset یا حذف، peer مربوط به WireGuard را در حساب PIA باط
|
||||
}
|
||||
```
|
||||
|
||||
### اسکریپتهای Lua
|
||||
|
||||
Xray 26.10.10 میتواند مسیریابی و DNS را به Lua بسپارد. **پایه ← اسکریپت مسیریابی**
|
||||
مسیر یک فایل `.lua` را میگیرد که `HandleRoute` را تعریف میکند (مطلق یا نسبت به
|
||||
پوشهی `bin` در Xray)؛ **DNS ← اسکریپت Lua** فایلی را میگیرد که `HandleDNSQuery` را
|
||||
تعریف میکند، و **شناسه**ی هر سرور DNS نامی است که اسکریپت با آن سرور را انتخاب میکند.
|
||||
|
||||
<Callout type="warn">
|
||||
اسکریپت مسیریابی جای **همهی** قوانین مسیریابی را میگیرد، از جمله قانون `api` خود
|
||||
پنل. در اسکریپت، اینباند `api` را به اوتباند `api` بفرستید، وگرنه آمار ترافیک و
|
||||
اعمال زندهی تغییرات کلاینتها متوقف میشود. اگر فایل وجود نداشته باشد یا بارگذاری
|
||||
نشود، Xray اجرا نمیشود.
|
||||
</Callout>
|
||||
|
||||
## متعادلکنندهها
|
||||
|
||||
یک **متعادلکننده** خروجیها را با یک **انتخابگر** (پیشوندهای برچسب، از جمله مجموعههای
|
||||
|
||||
@@ -165,6 +165,20 @@ hostname получает уникальный тег `nord-<hostname>` и не
|
||||
}
|
||||
```
|
||||
|
||||
### Lua-скрипты
|
||||
|
||||
Xray 26.10.10 умеет передавать маршрутизацию и DNS в Lua. **Основное → Скрипт
|
||||
маршрутизации** принимает путь к файлу `.lua` с функцией `HandleRoute` (абсолютный
|
||||
или относительно папки `bin` Xray); **DNS → Lua-скрипт** — файл с функцией
|
||||
`HandleDNSQuery`, а **ID** DNS-сервера — имя, по которому такой скрипт его выбирает.
|
||||
|
||||
<Callout type="warn">
|
||||
Скрипт маршрутизации заменяет **все** правила маршрутизации, включая собственное
|
||||
правило `api` панели. Направляйте в скрипте входящий `api` на исходящий `api`,
|
||||
иначе остановятся статистика трафика и применение изменений клиентов на лету. Xray не
|
||||
запустится, если файл отсутствует или не загружается.
|
||||
</Callout>
|
||||
|
||||
## Балансировщики
|
||||
|
||||
**Балансировщик** группирует исходящие соединения по **селектору** (префиксы
|
||||
|
||||
Loaded 3 of 25 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user