Compare commits
8 Commits
nikki-v1.2
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| d531b70db3 | |||
| 249cb21a7f | |||
| edfcb7f82f | |||
| d030d7e23c | |||
| fd2a2dad87 | |||
| aa7810354c | |||
| 2561d0b5d4 | |||
| 180d3a2650 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -11,6 +11,7 @@
|
|||||||
__pycache__/
|
__pycache__/
|
||||||
tools/core/work/
|
tools/core/work/
|
||||||
tools/core/dist/
|
tools/core/dist/
|
||||||
|
tools/nikki-work/
|
||||||
|
|
||||||
# Local agent notes
|
# Local agent notes
|
||||||
/AGENTS.md
|
/AGENTS.md
|
||||||
|
|||||||
78
README.md
78
README.md
@ -21,7 +21,24 @@ ssh root@192.168.32.1 sh /etc/nikki/kit/install.sh
|
|||||||
```
|
```
|
||||||
|
|
||||||
Установщик ставит nikki (если нет), правильное ядро, фиксы и kit со страницей LuCI —
|
Установщик ставит nikki (если нет), правильное ядро, фиксы и kit со страницей LuCI —
|
||||||
ничего не спрашивает. Дальше всё в браузере: LuCI → **Службы → mihomo-kit**
|
ничего не спрашивает. Пакеты nikki берутся из релиза `nikki-<версия>` этого репозитория
|
||||||
|
(зеркало релиза [OpenWrt-nikki](https://github.com/nikkinikki-org/OpenWrt-nikki/releases)),
|
||||||
|
и только если там нет — с GitHub; зависимости — из обычных фидов OpenWrt. Нужна OpenWrt 24.10
|
||||||
|
(opkg); 25.12 с apk пока не поддерживается.
|
||||||
|
|
||||||
|
Если роутер не достаёт ни до одного источника — на компьютере скачать архив под свой роутер
|
||||||
|
(`nikki_<DISTRIB_ARCH>-openwrt-24.10.tar.gz`, арх — `grep DISTRIB_ARCH /etc/openwrt_release`;
|
||||||
|
установщик сам печатает имя и ссылку), положить в `/tmp` роутера и запустить с `NIKKI_TGZ`:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
scp -O nikki_aarch64_cortex-a53-openwrt-24.10.tar.gz root@192.168.32.1:/tmp/
|
||||||
|
ssh root@192.168.32.1 'NIKKI_TGZ=/tmp/nikki_aarch64_cortex-a53-openwrt-24.10.tar.gz sh /etc/nikki/kit/install.sh'
|
||||||
|
```
|
||||||
|
|
||||||
|
Архив релиза nikki — это готовый подписанный фид: установщик распаковывает его в `/tmp`,
|
||||||
|
временно подключает к opkg (подпись проверяется ключом nikki из kit,
|
||||||
|
`router/nikki-key-build.pub`), ставит `mihomo-meta nikki luci-app-nikki luci-i18n-nikki-ru`
|
||||||
|
и убирает фид. Не скачалось или не поставилось — установка останавливается с ошибкой. Дальше всё в браузере: LuCI → **Службы → mihomo-kit**
|
||||||
(адрес установщик печатает в конце; если пункта нет — выйти из LuCI и войти снова).
|
(адрес установщик печатает в конце; если пункта нет — выйти из LuCI и войти снова).
|
||||||
Страница разбита на вкладки по темам: «Обзор» (состояние, профиль), «Подписки» (подписки,
|
Страница разбита на вкладки по темам: «Обзор» (состояние, профиль), «Подписки» (подписки,
|
||||||
vless-ссылки BOOT), «Правила» (торренты, пуши, свои домены и IP), «Свои серверы», «Пулы и
|
vless-ссылки BOOT), «Правила» (торренты, пуши, свои домены и IP), «Свои серверы», «Пулы и
|
||||||
@ -307,6 +324,16 @@ claude.ai, claude.com, anthropic.com, clau.de, claudeusercontent.com…; `openai
|
|||||||
- `FOREIGN`, `RU`, `DIRECT`, `MAIN` или пул (ниже) — группа `select`, где это первый пункт, а
|
- `FOREIGN`, `RU`, `DIRECT`, `MAIN` или пул (ниже) — группа `select`, где это первый пункт, а
|
||||||
остальные можно выбрать в дашборде.
|
остальные можно выбрать в дашборде.
|
||||||
|
|
||||||
|
Списки доменов из файлов — поле «Списки доменов» (`SVC_<ИМЯ>_HOSTLIST`, пути через пробел): по
|
||||||
|
домену в строке, как хостлисты zapret. Если на роутере стоит zapret2 / zapret, под полем есть
|
||||||
|
кнопки с его списками из `/opt/zapret2/ipset/` и `/opt/zapret/ipset/` (без `*exclude*`): нажал —
|
||||||
|
файл добавлен, ещё раз — убран. Копировать ничего не нужно: файл читается при каждой сборке
|
||||||
|
профиля (поменялся список в zapret — «Применить»), домены уходят в inline rule-provider
|
||||||
|
`hostlist-<имя>` (`behavior: domain`, поиск по дереву — тысячи доменов не тормозят правила) и
|
||||||
|
попадают и в конфиг телефона. Как в zapret: `youtube.com` — с поддоменами, `^youtube.com` —
|
||||||
|
только он сам; `#`-комментарии, IP и мусор пропускаются, `.gz` читается. Файла нет — сборка
|
||||||
|
предупреждает и идёт дальше без него.
|
||||||
|
|
||||||
Чтобы сервис сохранял **один конкретный выходной сервер** при смене main/whitelist/foreign,
|
Чтобы сервис сохранял **один конкретный выходной сервер** при смене main/whitelist/foreign,
|
||||||
на графе откройте сервис → «Выход сервиса» → «Фиксированный сервер». Выберите источник
|
на графе откройте сервис → «Выход сервиса» → «Фиксированный сервер». Выберите источник
|
||||||
(«Свои серверы» или конкретную подписку) и имя из подсказок, затем «Сохранить и применить».
|
(«Свои серверы» или конкретную подписку) и имя из подсказок, затем «Сохранить и применить».
|
||||||
@ -367,6 +394,7 @@ SERVICES="claude"
|
|||||||
SVC_CLAUDE_GEOSITE="anthropic" # через пробел, если списков несколько
|
SVC_CLAUDE_GEOSITE="anthropic" # через пробел, если списков несколько
|
||||||
SVC_CLAUDE_DOMAINS="" # ещё домены (с поддоменами)
|
SVC_CLAUDE_DOMAINS="" # ещё домены (с поддоменами)
|
||||||
SVC_CLAUDE_IPS="" # ещё IP / подсети
|
SVC_CLAUDE_IPS="" # ещё IP / подсети
|
||||||
|
SVC_CLAUDE_HOSTLIST="" # файлы со списками доменов (хостлисты zapret), через пробел
|
||||||
SVC_CLAUDE_VIA=MY # MY | FOREIGN | RU | DIRECT | MAIN | пул (DE)
|
SVC_CLAUDE_VIA=MY # MY | FOREIGN | RU | DIRECT | MAIN | пул (DE)
|
||||||
SVC_CLAUDE_CHAIN="" # вход для MY / пула: DIRECT | FOREIGN | RU | MY | MY-EXIT | пул
|
SVC_CLAUDE_CHAIN="" # вход для MY / пула: DIRECT | FOREIGN | RU | MY | MY-EXIT | пул
|
||||||
|
|
||||||
@ -392,6 +420,24 @@ mihomo разбирает подписку (`luci/servers.js` — перенос
|
|||||||
сверяет с ним): reality, xhttp, ws, grpc и прочее — как в приложении. «Скопировать» отдаёт
|
сверяет с ним): reality, xhttp, ws, grpc и прочее — как в приложении. «Скопировать» отдаёт
|
||||||
сервер как YAML для другого роутера.
|
сервер как YAML для другого роутера.
|
||||||
|
|
||||||
|
«Вход» в карточке — через что подключаться к самому серверу. «Как обычно» — как остальные
|
||||||
|
свои серверы: на `main` напрямую, на `whitelist` и телефоне через `MY-EXIT`, с CSQTT через
|
||||||
|
`UPLINK`. «Через FOREIGN», «через RU», «напрямую» или «через пул» действует только для этого
|
||||||
|
сервера и во всех профилях и в конфиге телефона: например, сервер, до которого напрямую не
|
||||||
|
достучаться, идёт через ноды FOREIGN, а остальные свои серверы — как раньше. Хранится как
|
||||||
|
`dialer-proxy` в строке сервера (`/etc/nikki/my-servers`); `dialer-proxy`, вписанный в
|
||||||
|
«Настройки (YAML)», становится тем же «Входом». Пул, в который сервер входит сам, как вход
|
||||||
|
нельзя — это петля.
|
||||||
|
|
||||||
|
Тот же «Вход» есть у серверов, которые лежат в своей подписке с `[MY]` в имени: блок «Из
|
||||||
|
подписок ([MY])» на той же вкладке. Их список страница берёт из работающего mihomo (nikki не
|
||||||
|
запущен — видны только ноды, у которых вход уже задан). Нода с входом уходит из провайдера
|
||||||
|
`<подписка>-my` в `<подписка>-my-via-<вход>`: тот же файл подписки (на телефоне — ещё одна
|
||||||
|
загрузка), только эти ноды, `dialer-proxy` = вход. Он стоит везде, где `<подписка>-my`: в MY,
|
||||||
|
пулах, сервисах. В `common.env` это `MY_NODE_1='FOREIGN|<подписка>-my|<точное имя>'`,
|
||||||
|
`MY_NODE_2=…`. Ноду ищут по точному имени: переименовали в подписке — вход перестаёт
|
||||||
|
действовать, нода снова идёт как остальные `[MY]`.
|
||||||
|
|
||||||
AmneziaWG: туда же вставляется ключ AmneziaVPN `vpn://…` («Поделиться» в приложении; файл
|
AmneziaWG: туда же вставляется ключ AmneziaVPN `vpn://…` («Поделиться» в приложении; файл
|
||||||
`.vpn` тоже можно выбрать) или `.conf` AmneziaWG / обычного WireGuard (текст `[Interface]` …
|
`.vpn` тоже можно выбрать) или `.conf` AmneziaWG / обычного WireGuard (текст `[Interface]` …
|
||||||
`[Peer]` … или файл — тогда сервер называется по имени файла). Получается сервер
|
`[Peer]` … или файл — тогда сервер называется по имени файла). Получается сервер
|
||||||
@ -555,6 +601,15 @@ RU-адреса, без OpenVPN, Tailscale, торрентов и `PUSH`; сво
|
|||||||
`wget`/`opkg` самого роутера (обновления kit, ядро) нужна ещё запись в dnsmasq:
|
`wget`/`opkg` самого роутера (обновления kit, ядро) нужна ещё запись в dnsmasq:
|
||||||
`uci add_list dhcp.@dnsmasq[0].address='/sam-hub.net/192.168.64.20'`.
|
`uci add_list dhcp.@dnsmasq[0].address='/sam-hub.net/192.168.64.20'`.
|
||||||
|
|
||||||
|
Клиенты мимо mihomo — LuCI → вкладка «Правила» → «Клиенты мимо mihomo» (`BYPASS_CLIENTS` в
|
||||||
|
`common.env`): IP-адреса, подсети и MAC-адреса через пробел. Их трафик и DNS nikki вообще не
|
||||||
|
отдаёт в mihomo, они идут напрямую. Нужно, например, когда за этим роутером второй роутер со
|
||||||
|
своим kit: иначе его трафик дважды заворачивается в прокси (сначала на втором, потом на этом).
|
||||||
|
MAC надёжнее IP: адрес по DHCP может смениться (или закрепить его в Сеть → DHCP и DNS). Это
|
||||||
|
секция `lan_access_control` самого nikki (`proxy 0`, `dns 0`), которую `use` и «Сохранить и
|
||||||
|
применить» ставят первой — первое совпадение побеждает. Только для этого роутера: при импорте
|
||||||
|
с `--keep-local` остаётся своя.
|
||||||
|
|
||||||
Правила выбираются по имени сайта: его mihomo знает из своего DNS или достаёт сниффером из
|
Правила выбираются по имени сайта: его mihomo знает из своего DNS или достаёт сниффером из
|
||||||
рукопожатия TLS/QUIC. Сайты за Cloudflare с ECH (браузер получил ключи через свой DoH)
|
рукопожатия TLS/QUIC. Сайты за Cloudflare с ECH (браузер получил ключи через свой DoH)
|
||||||
показывают в рукопожатии не своё имя, а `cloudflare-ech.com`. Такое имя сниффер пропускает
|
показывают в рукопожатии не своё имя, а `cloudflare-ech.com`. Такое имя сниффер пропускает
|
||||||
@ -667,7 +722,8 @@ router/
|
|||||||
luci/ страница LuCI «Службы → mihomo-kit»: rpcd.sh (бэкенд), view, ACL, меню,
|
luci/ страница LuCI «Службы → mihomo-kit»: rpcd.sh (бэкенд), view, ACL, меню,
|
||||||
servers.js (ссылки и YAML своих серверов), qrcode.js
|
servers.js (ссылки и YAML своих серверов), qrcode.js
|
||||||
tools/ push.sh, test.sh, test-servers.js, servers-ref.sh + servers-ref/ (эталоны
|
tools/ push.sh, test.sh, test-servers.js, servers-ref.sh + servers-ref/ (эталоны
|
||||||
для servers.js из Go-кода mihomo), core/ (ядро kit)
|
для servers.js из Go-кода mihomo), core/ (ядро kit),
|
||||||
|
nikki-mirror.sh (зеркало пакетов nikki в релизах)
|
||||||
tests/fixtures/ профили для test.sh (фиктивные секреты), own.servers
|
tests/fixtures/ профили для test.sh (фиктивные секреты), own.servers
|
||||||
tests/expected/ эталонный YAML каждого профиля
|
tests/expected/ эталонный YAML каждого профиля
|
||||||
tests/links/, yaml/ ссылки и YAML с выводом Go-кода mihomo для luci/servers.js
|
tests/links/, yaml/ ссылки и YAML с выводом Go-кода mihomo для luci/servers.js
|
||||||
@ -707,6 +763,24 @@ tests/links/, yaml/ ссылки и YAML с выводом Go-кода mihomo д
|
|||||||
Новая версия mihomo или новая правка — следующий суффикс (`ts9`) в шагах 1–3. Патчи
|
Новая версия mihomo или новая правка — следующий суффикс (`ts9`) в шагах 1–3. Патчи
|
||||||
применяются по алфавиту; если не накладываются, поправить их на новом теге.
|
применяются по алфавиту; если не накладываются, поправить их на новом теге.
|
||||||
|
|
||||||
|
### Зеркало nikki
|
||||||
|
|
||||||
|
Роутер ставит nikki из релиза `nikki-<NIKKI_VERSION>` репозитория kit (GitHub из России
|
||||||
|
часто недоступен). Обновить зеркало на новый релиз nikki (нужны curl, jq; токен Gitea с
|
||||||
|
правом `write:repository`):
|
||||||
|
|
||||||
|
```sh
|
||||||
|
GITEA_TOKEN=... tools/nikki-mirror.sh latest # все архитектуры, OpenWrt 24.10
|
||||||
|
GITEA_TOKEN=... tools/nikki-mirror.sh v1.26.2 aarch64_cortex-a53 mipsel_24kc # только эти
|
||||||
|
```
|
||||||
|
|
||||||
|
Скрипт создаёт релиз `nikki-<версия>`, качает `nikki_<arch>-openwrt-24.10.tar.gz` с GitHub,
|
||||||
|
убирает из них `mihomo-alpha` и переводы zh (меньше памяти на роутере; `Packages` и подпись
|
||||||
|
не меняются) и выкладывает. Уже выложенные пропускает — можно дозапустить. Потом
|
||||||
|
`NIKKI_VERSION` в `router/mihomo-kit.sh` — та же версия, и пушить кит. Ключ nikki
|
||||||
|
(`router/nikki-key-build.pub`) менять, только если nikki сменит ключ подписи
|
||||||
|
(`https://nikkinikki.pages.dev/key-build.pub`).
|
||||||
|
|
||||||
После правки шаблонов, скрипта или `luci/servers.js`:
|
После правки шаблонов, скрипта или `luci/servers.js`:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
|||||||
60
TODO.md
Normal file
60
TODO.md
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
# Технический долг и планы
|
||||||
|
|
||||||
|
Что стоит сделать в kit дальше. Сверху — то, что страхует от поломок, ниже — новые возможности.
|
||||||
|
|
||||||
|
## Надёжность кода
|
||||||
|
|
||||||
|
- **`local` в функциях `router/mihomo-kit.sh`.** Переменные в sh глобальные, и функции затирают
|
||||||
|
их друг другу. Уже было: `pool_vars` перезаписывал `_n` у `own_entries_check`, и проверка
|
||||||
|
петли молча не срабатывала. ash в busybox понимает `local` — перевести на него хотя бы функции,
|
||||||
|
которые вызывают другие (`pool_vars`, `variant_members`, `sub_vars`, `*_vars`).
|
||||||
|
- **Тесты роутерной части.** `tools/test.sh` проверяет только рендер. Миграции
|
||||||
|
(`migrate_openvpn`, `migrate_profiles`), `bypass_uci`, `nikki_defaults`, `opkg_fit`, cron,
|
||||||
|
`ovpn.sh` (пароль с TOTP и без, шифры из `.ovpn`, `routes_set`) проверялись руками. Добавить
|
||||||
|
прогоны с поддельными `uci`, `opkg`, `curl`, `/etc/init.d/*` в `PATH`, которые пишут вызовы в
|
||||||
|
лог, и сравнивать лог с эталоном.
|
||||||
|
- **Проверка JS.** Страницы LuCI правились без запуска: `node --check luci/*.js` в
|
||||||
|
`tools/test.sh` (когда есть node) и тесты `tools/test-*.js` в CI.
|
||||||
|
- **CI на Gitea Actions.** `tools/test.sh` с node и `MIHOMO=…` (`mihomo -t` по всем профилям)
|
||||||
|
на каждый пуш: роутеры берут kit прямо из `main`.
|
||||||
|
- **Разбить `luci/mihomo-kit.js`.** `renderSettings` — одна функция на сотни строк. После вкладок
|
||||||
|
естественно резать её по вкладке на функцию (подписки, правила, свои серверы, OpenVPN, …).
|
||||||
|
|
||||||
|
## Известные слабые места
|
||||||
|
|
||||||
|
- **OpenVPN сразу после старта nikki.** Имя сервера резолвится через DNS mihomo (`respect-rules`,
|
||||||
|
через `MAIN`); пока он не готов, туннель не находит сервер и поднимается только через
|
||||||
|
`DOWN_GRACE` (5 минут). Узнавать IP сервера в `ovpn.sh` при записи провайдера напрямую
|
||||||
|
(77.88.8.8) и писать IP вместо имени.
|
||||||
|
- **`MAIN = DIRECT` переезжает между профилями** (`cache.db` по имени группы): выбрал дома —
|
||||||
|
на whitelist нет интернета. Хотя бы предупреждение на «Обзоре», а лучше сброс `MAIN` при
|
||||||
|
смене профиля или отдельный профиль `behind` (за другим роутером: только OpenVPN и Tailscale,
|
||||||
|
остальное `DIRECT`).
|
||||||
|
- **`OVPN-EXIT` только из RU-нод** — рассчитано на VPN-сервер в России. Дать выбор страны или
|
||||||
|
любой ноды.
|
||||||
|
- **OpenVPN:** профили только с сертификатом (без `auth-user-pass`) сейчас требуют логин;
|
||||||
|
внутренние домены за VPN не резолвятся через DNS самого VPN.
|
||||||
|
- **Ноды `[MY]` с входом ищутся по точному имени:** переименовали в подписке — вход молча
|
||||||
|
перестаёт действовать. Показывать в LuCI заданные входы, для которых ноды больше нет.
|
||||||
|
- **`opkg_fit`** не проверен на живом маленьком роутере: печатает ли `opkg --noaction` строки
|
||||||
|
`Installing …` (иначе откатывается к обычному `opkg install`).
|
||||||
|
|
||||||
|
## Порт на OpenWrt 25.12
|
||||||
|
|
||||||
|
opkg заменён на apk: `cmd_install`, `opkg_fit`, `pkg-install` (`.ipk` → `.apk`, нет
|
||||||
|
`--force-space`, свой подсчёт места), `lite_intercept`. Определять менеджер пакетов и держать
|
||||||
|
обе ветки. Генерация конфигов, LuCI, `use`, `fix`, ядро от этого не зависят.
|
||||||
|
|
||||||
|
## Новые возможности
|
||||||
|
|
||||||
|
- **Автоопределение белых списков:** роутер раз в N минут проверяет, открываются ли зарубежные
|
||||||
|
адреса напрямую, и сам переключает `main` ↔ `whitelist` (с гистерезисом, чтобы не прыгать).
|
||||||
|
- **Маршрут по устройству:** развитие `BYPASS_CLIENTS` — не только «мимо mihomo», но и «это
|
||||||
|
устройство всегда через FOREIGN / MY / пул» (`SRC-IP-CIDR` в начале правил; MAC → IP по
|
||||||
|
DHCP-арендам).
|
||||||
|
- **Выбор из DHCP-клиентов** в LuCI для `BYPASS_CLIENTS` и маршрутов по устройству, а не ввод MAC
|
||||||
|
руками.
|
||||||
|
- **Уведомления в Telegram:** OpenVPN не поднимается, обновление kit упало, подписка не
|
||||||
|
скачивается, ядро откатилось.
|
||||||
|
- **Откат обновления kit:** сохранять предыдущую версию перед `update`, кнопка «вернуть
|
||||||
|
предыдущую».
|
||||||
@ -762,9 +762,9 @@
|
|||||||
// each returning a promise: select(group, name), unfix(group), delay(group, url) -> {name: ms},
|
// each returning a promise: select(group, name), unfix(group), delay(group, url) -> {name: ms},
|
||||||
// refresh() - poll now; saveServices(services, pools) - the kit's services and pools (SERVICES,
|
// refresh() - poll now; saveServices(services, pools) - the kit's services and pools (SERVICES,
|
||||||
// POOLS), then the page shows the rebuilt profile (only on the router)
|
// POOLS), then the page shows the rebuilt profile (only on the router)
|
||||||
// show(cfg, meta): meta.services [{name, geosite, domains, ips, via}], meta.pools [{name, type,
|
// show(cfg, meta): meta.services [{name, geosite, domains, ips, hostlist, via}], meta.pools [{name, type,
|
||||||
// servers, subs, filter, exclude}] - which groups are services / pools; meta.servers, meta.subs -
|
// servers, subs, filter, exclude}] - which groups are services / pools; meta.servers, meta.subs -
|
||||||
// own server names and providers a pool can take
|
// own server names and providers a pool can take; meta.hostlists [{path, lines}] - zapret's lists
|
||||||
function view(container, act) {
|
function view(container, act) {
|
||||||
if (!document.getElementById('mkg-style'))
|
if (!document.getElementById('mkg-style'))
|
||||||
document.head.appendChild(el('style', { id: 'mkg-style', text: CSS }));
|
document.head.appendChild(el('style', { id: 'mkg-style', text: CSS }));
|
||||||
@ -1162,17 +1162,48 @@
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
// zapret hostlists (meta.hostlists [{path, lines}]) as buttons under the service's
|
||||||
|
// hostlist field: a click adds the file to it or takes it out
|
||||||
|
var hostlistPicker = function(inp) {
|
||||||
|
var files = meta.hostlists || [];
|
||||||
|
if (!files.length)
|
||||||
|
return null;
|
||||||
|
var words = function() { return inp.value.trim().split(/\s+/).filter(Boolean); };
|
||||||
|
var buttons = files.map(function(fl) {
|
||||||
|
var b = el('button', { 'class': 'btn cbi-button', title: fl.path, onclick: function(ev) {
|
||||||
|
ev.preventDefault();
|
||||||
|
var w = words(), i = w.indexOf(fl.path);
|
||||||
|
if (i < 0) w.push(fl.path); else w.splice(i, 1);
|
||||||
|
inp.value = w.join(' ');
|
||||||
|
mark();
|
||||||
|
} });
|
||||||
|
b.mkFile = fl;
|
||||||
|
return b;
|
||||||
|
});
|
||||||
|
var mark = function() {
|
||||||
|
var w = words();
|
||||||
|
buttons.forEach(function(b) {
|
||||||
|
var on = w.indexOf(b.mkFile.path) >= 0;
|
||||||
|
b.textContent = (on ? '✓ ' : '+ ') + b.mkFile.path.replace(/^.*\//, '') + ' (' + b.mkFile.lines + ')';
|
||||||
|
b.className = 'btn cbi-button' + (on ? ' cbi-button-positive' : '');
|
||||||
|
});
|
||||||
|
};
|
||||||
|
inp.addEventListener('input', mark);
|
||||||
|
mark();
|
||||||
|
return el('div', { 'class': 'acts' }, [ 'из zapret:' ].concat(buttons));
|
||||||
|
};
|
||||||
var editor = function(svc) {
|
var editor = function(svc) {
|
||||||
var key = svc ? 'svc:' + svc.name : 'new';
|
var key = svc ? 'svc:' + svc.name : 'new';
|
||||||
if (editors[key])
|
if (editors[key])
|
||||||
return editors[key];
|
return editors[key];
|
||||||
svc = svc || { name: '', geosite: '', domains: '', ips: '', via: 'MY', chain: '', server: '', provider: '' };
|
svc = svc || { name: '', geosite: '', domains: '', ips: '', hostlist: '', via: 'MY', chain: '', server: '', provider: '' };
|
||||||
var input = function(v, ph) { return el('input', { type: 'text', value: v || '', placeholder: ph }); };
|
var input = function(v, ph) { return el('input', { type: 'text', value: v || '', placeholder: ph }); };
|
||||||
var f = {
|
var f = {
|
||||||
name: input(svc.name, 'claude'),
|
name: input(svc.name, 'claude'),
|
||||||
geosite: input(svc.geosite, 'anthropic'),
|
geosite: input(svc.geosite, 'anthropic'),
|
||||||
domains: input(svc.domains, 'example.com'),
|
domains: input(svc.domains, 'example.com'),
|
||||||
ips: input(svc.ips, '1.2.3.0/24'),
|
ips: input(svc.ips, '1.2.3.0/24'),
|
||||||
|
hostlist: input(svc.hostlist, '/opt/zapret2/ipset/zapret_hosts_youtube.txt'),
|
||||||
mode: el('select', {}, [ [ '', 'Группа / автовыбор' ], [ 'fixed', 'Фиксированный сервер' ] ]
|
mode: el('select', {}, [ [ '', 'Группа / автовыбор' ], [ 'fixed', 'Фиксированный сервер' ] ]
|
||||||
.map(function(o) { return el('option', { value: o[0] }, [ o[1] ]); })),
|
.map(function(o) { return el('option', { value: o[0] }, [ o[1] ]); })),
|
||||||
provider: el('select', {}, [ [ '', 'Свои серверы' ] ].concat((meta.subs || []).map(function(id) {
|
provider: el('select', {}, [ [ '', 'Свои серверы' ] ].concat((meta.subs || []).map(function(id) {
|
||||||
@ -1219,7 +1250,7 @@
|
|||||||
var buttons = [], save = saver(say, buttons);
|
var buttons = [], save = saver(say, buttons);
|
||||||
var saveBtn = el('button', { 'class': 'btn cbi-button cbi-button-apply', onclick: function() {
|
var saveBtn = el('button', { 'class': 'btn cbi-button cbi-button-apply', onclick: function() {
|
||||||
var v = { name: f.name.value.trim().toLowerCase(), geosite: f.geosite.value.trim(), domains: f.domains.value.trim(),
|
var v = { name: f.name.value.trim().toLowerCase(), geosite: f.geosite.value.trim(), domains: f.domains.value.trim(),
|
||||||
ips: f.ips.value.trim(), via: f.via.value, chain: f.chain.value,
|
ips: f.ips.value.trim(), hostlist: f.hostlist.value.trim(), via: f.via.value, chain: f.chain.value,
|
||||||
server: f.mode.value ? f.server.value.trim() : '', provider: f.mode.value ? f.provider.value : '' };
|
server: f.mode.value ? f.server.value.trim() : '', provider: f.mode.value ? f.provider.value : '' };
|
||||||
var others = services.filter(function(x) { return !svc.name || x.name != svc.name; });
|
var others = services.filter(function(x) { return !svc.name || x.name != svc.name; });
|
||||||
var bad = nameError(v.name, svcOf);
|
var bad = nameError(v.name, svcOf);
|
||||||
@ -1227,8 +1258,8 @@
|
|||||||
return say(bad, true);
|
return say(bad, true);
|
||||||
if (others.some(function(x) { return x.name == v.name; }))
|
if (others.some(function(x) { return x.name == v.name; }))
|
||||||
return say('сервис ' + v.name + ' уже есть', true);
|
return say('сервис ' + v.name + ' уже есть', true);
|
||||||
if (!v.geosite && !v.domains && !v.ips)
|
if (!v.geosite && !v.domains && !v.ips && !v.hostlist)
|
||||||
return say('нужен geosite, домены или IP', true);
|
return say('нужен geosite, домены, IP или список доменов', true);
|
||||||
if (f.mode.value && !v.server)
|
if (f.mode.value && !v.server)
|
||||||
return say('выбери или введи имя фиксированного сервера', true);
|
return say('выбери или введи имя фиксированного сервера', true);
|
||||||
if (v.chain && !v.server && v.via != 'MY' && !poolOf[v.via])
|
if (v.chain && !v.server && v.via != 'MY' && !poolOf[v.via])
|
||||||
@ -1253,6 +1284,8 @@
|
|||||||
el('label', {}, [ 'geosite (MetaCubeX/meta-rules-dat, через пробел)', f.geosite ]),
|
el('label', {}, [ 'geosite (MetaCubeX/meta-rules-dat, через пробел)', f.geosite ]),
|
||||||
el('label', {}, [ 'домены (с поддоменами)', f.domains ]),
|
el('label', {}, [ 'домены (с поддоменами)', f.domains ]),
|
||||||
el('label', {}, [ 'IP / подсети', f.ips ]),
|
el('label', {}, [ 'IP / подсети', f.ips ]),
|
||||||
|
el('label', {}, [ 'списки доменов: файлы, по домену в строке (хостлисты zapret), через пробел', f.hostlist ]),
|
||||||
|
hostlistPicker(f.hostlist),
|
||||||
el('label', {}, [ 'выход сервиса', f.mode ]),
|
el('label', {}, [ 'выход сервиса', f.mode ]),
|
||||||
fixedBox,
|
fixedBox,
|
||||||
el('label', {}, [ 'через что (или потяни от группы к MY / FOREIGN / RU / MAIN / DIRECT / пулу)', f.via ]),
|
el('label', {}, [ 'через что (или потяни от группы к MY / FOREIGN / RU / MAIN / DIRECT / пулу)', f.via ]),
|
||||||
|
|||||||
@ -97,7 +97,7 @@ return view.extend({
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
this.graph.show(window.mkServers.yamlLoad(g.yaml),
|
this.graph.show(window.mkServers.yamlLoad(g.yaml),
|
||||||
{ services: g.services || [], pools: g.pools || [], servers: g.servers || [], subs: g.subs || [] });
|
{ services: g.services || [], pools: g.pools || [], servers: g.servers || [], subs: g.subs || [], hostlists: g.hostlists || [] });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
dom.content(this.state, E('p', { 'class': 'alert-message warning' }, 'Не разобрал профиль: ' + e.message));
|
dom.content(this.state, E('p', { 'class': 'alert-message warning' }, 'Не разобрал профиль: ' + e.message));
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -19,6 +19,7 @@ var callTsCheck = rpc.declare({ object: 'mihomo-kit', method: 'ts_check', nobatc
|
|||||||
var callUpdateCheck = rpc.declare({ object: 'mihomo-kit', method: 'update_check', nobatch: true, expect: { '': {} } });
|
var callUpdateCheck = rpc.declare({ object: 'mihomo-kit', method: 'update_check', nobatch: true, expect: { '': {} } });
|
||||||
var callExport = rpc.declare({ object: 'mihomo-kit', method: 'export', expect: { '': {} } });
|
var callExport = rpc.declare({ object: 'mihomo-kit', method: 'export', expect: { '': {} } });
|
||||||
var callImport = rpc.declare({ object: 'mihomo-kit', method: 'import', params: [ 'data', 'keep_local' ], expect: { '': {} } });
|
var callImport = rpc.declare({ object: 'mihomo-kit', method: 'import', params: [ 'data', 'keep_local' ], expect: { '': {} } });
|
||||||
|
var callApi = rpc.declare({ object: 'mihomo-kit', method: 'api', params: [ 'path' ], nobatch: true, expect: { '': {} } });
|
||||||
var callConfigGet = rpc.declare({ object: 'mihomo-kit', method: 'config_get', expect: { '': {} } });
|
var callConfigGet = rpc.declare({ object: 'mihomo-kit', method: 'config_get', expect: { '': {} } });
|
||||||
var callConfigSet = rpc.declare({ object: 'mihomo-kit', method: 'config_set', params: [ 'data' ], expect: { '': {} } });
|
var callConfigSet = rpc.declare({ object: 'mihomo-kit', method: 'config_set', params: [ 'data' ], expect: { '': {} } });
|
||||||
|
|
||||||
@ -112,6 +113,36 @@ function check(value) {
|
|||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// zapret hostlists (cfg.hostlists [{path, lines}]) as buttons under the service's hostlist
|
||||||
|
// field: a click adds the file to it or takes it out; nothing when zapret has no lists
|
||||||
|
function hostlistPicker(input, files) {
|
||||||
|
if (!files || !files.length)
|
||||||
|
return [];
|
||||||
|
var words = function() { return input.value.trim().split(/\s+/).filter(Boolean); };
|
||||||
|
var buttons = files.map(function(f) {
|
||||||
|
var b = E('button', { 'class': 'btn cbi-button', 'title': f.path, 'style': 'margin:.2em .3em 0 0', 'click': function(ev) {
|
||||||
|
ev.preventDefault();
|
||||||
|
var w = words(), i = w.indexOf(f.path);
|
||||||
|
if (i < 0) w.push(f.path); else w.splice(i, 1);
|
||||||
|
input.value = w.join(' ');
|
||||||
|
mark();
|
||||||
|
} });
|
||||||
|
b.mkFile = f;
|
||||||
|
return b;
|
||||||
|
});
|
||||||
|
var mark = function() {
|
||||||
|
var w = words();
|
||||||
|
buttons.forEach(function(b) {
|
||||||
|
var on = w.indexOf(b.mkFile.path) >= 0;
|
||||||
|
b.textContent = (on ? '✓ ' : '+ ') + b.mkFile.path.replace(/^.*\//, '') + ' (' + b.mkFile.lines + ')';
|
||||||
|
b.className = 'btn cbi-button' + (on ? ' cbi-button-positive' : '');
|
||||||
|
});
|
||||||
|
};
|
||||||
|
input.addEventListener('input', mark);
|
||||||
|
mark();
|
||||||
|
return [ E('div', {}, [ E('small', {}, 'из zapret: ') ].concat(buttons)) ];
|
||||||
|
}
|
||||||
|
|
||||||
function field(title, el, desc) {
|
function field(title, el, desc) {
|
||||||
return E('div', { 'class': 'cbi-value' }, [
|
return E('div', { 'class': 'cbi-value' }, [
|
||||||
E('label', { 'class': 'cbi-value-title' }, title),
|
E('label', { 'class': 'cbi-value-title' }, title),
|
||||||
@ -575,6 +606,7 @@ return view.extend({
|
|||||||
foreign_domains: text(cfg.foreign_domains, 'example.com *.example.org'),
|
foreign_domains: text(cfg.foreign_domains, 'example.com *.example.org'),
|
||||||
my_domains: text(cfg.my_domains, 'example.com *.example.org'),
|
my_domains: text(cfg.my_domains, 'example.com *.example.org'),
|
||||||
local_hosts: text(cfg.local_hosts, 'example.com=192.168.1.10'),
|
local_hosts: text(cfg.local_hosts, 'example.com=192.168.1.10'),
|
||||||
|
bypass_clients: text(cfg.bypass_clients, '192.168.1.50 aa:bb:cc:dd:ee:ff'),
|
||||||
openvpn: check(cfg.openvpn),
|
openvpn: check(cfg.openvpn),
|
||||||
csqtt: check(cfg.csqtt),
|
csqtt: check(cfg.csqtt),
|
||||||
ovpn: E('input', { 'type': 'file', 'accept': '.ovpn,.conf' }),
|
ovpn: E('input', { 'type': 'file', 'accept': '.ovpn,.conf' }),
|
||||||
@ -676,7 +708,8 @@ return view.extend({
|
|||||||
provider: text(v.provider || '', 'пусто — свои серверы; иначе ID провайдера'),
|
provider: text(v.provider || '', 'пусто — свои серверы; иначе ID провайдера'),
|
||||||
geosite: text(v.geosite || '', 'anthropic'),
|
geosite: text(v.geosite || '', 'anthropic'),
|
||||||
domains: text(v.domains || '', 'example.com'),
|
domains: text(v.domains || '', 'example.com'),
|
||||||
ips: text(v.ips || '', '1.2.3.0/24')
|
ips: text(v.ips || '', '1.2.3.0/24'),
|
||||||
|
hostlist: text(v.hostlist || '', '/opt/zapret2/ipset/zapret_hosts_youtube.txt')
|
||||||
};
|
};
|
||||||
e.name.style.width = '9em';
|
e.name.style.width = '9em';
|
||||||
viaOptions(e.via);
|
viaOptions(e.via);
|
||||||
@ -698,6 +731,9 @@ return view.extend({
|
|||||||
field('geosite', e.geosite, 'списки MetaCubeX/meta-rules-dat через пробел: anthropic, openai, youtube…'),
|
field('geosite', e.geosite, 'списки MetaCubeX/meta-rules-dat через пробел: anthropic, openai, youtube…'),
|
||||||
field('Домены', e.domains, 'ещё домены, с поддоменами'),
|
field('Домены', e.domains, 'ещё домены, с поддоменами'),
|
||||||
field('IP', e.ips, 'ещё адреса, без маски = /32'),
|
field('IP', e.ips, 'ещё адреса, без маски = /32'),
|
||||||
|
field('Списки доменов', [ e.hostlist ].concat(hostlistPicker(e.hostlist, cfg.hostlists)),
|
||||||
|
'файлы со списком доменов, по одному в строке (хостлисты zapret), через пробел; читаются при каждой ' +
|
||||||
|
'сборке профиля — изменился список в zapret: «Применить»'),
|
||||||
field('Фиксированный сервер', e.server, 'точное имя; выбор сохраняется во всех профилях. Удобнее выбирать на графе'),
|
field('Фиксированный сервер', e.server, 'точное имя; выбор сохраняется во всех профилях. Удобнее выбирать на графе'),
|
||||||
field('Источник сервера', e.provider, 'для подписки — ID провайдера, например sam_hub-my; для своего сервера оставить пустым'),
|
field('Источник сервера', e.provider, 'для подписки — ID провайдера, например sam_hub-my; для своего сервера оставить пустым'),
|
||||||
field('Вход', e.chain, 'для фиксированного сервера, MY или пула: через что подключаться к его серверам (например, ' +
|
field('Вход', e.chain, 'для фиксированного сервера, MY или пула: через что подключаться к его серверам (например, ' +
|
||||||
@ -718,17 +754,39 @@ return view.extend({
|
|||||||
servers.forEach(function(e) { t[e.name.value.trim()] = true; });
|
servers.forEach(function(e) { t[e.name.value.trim()] = true; });
|
||||||
return t;
|
return t;
|
||||||
};
|
};
|
||||||
|
// "Вход" of an own server (its own dialer-proxy): what it dials through in every
|
||||||
|
// profile instead of what the kit puts in front (MY-EXIT, UPLINK, directly)
|
||||||
|
var entryOptions = function(sel) {
|
||||||
|
var cur = sel.value || sel.getAttribute('data-entry') || '';
|
||||||
|
var names = pools.map(function(p) { return p.name.value.trim().toUpperCase(); }).filter(Boolean);
|
||||||
|
var opts = [ [ '', 'вход: как обычно' ], [ 'FOREIGN', 'вход: через FOREIGN' ], [ 'RU', 'вход: через RU' ],
|
||||||
|
[ 'DIRECT', 'вход: напрямую' ] ].concat(names.map(function(n) { return [ n, 'вход: через пул ' + n ]; }));
|
||||||
|
if (cur && !opts.some(function(o) { return o[0] == cur; }))
|
||||||
|
opts.push([ cur, 'вход: ' + cur + ' (такого нет)' ]);
|
||||||
|
dom.content(sel, opts.map(function(o) { return E('option', { 'value': o[0] }, o[1]); }));
|
||||||
|
sel.value = cur;
|
||||||
|
};
|
||||||
var addServer = function(p, open) {
|
var addServer = function(p, open) {
|
||||||
var e = { proxy: {}, error: null };
|
var e = { proxy: {}, error: null };
|
||||||
Object.keys(p).forEach(function(k) {
|
Object.keys(p).forEach(function(k) {
|
||||||
if (k != 'name' && k != 'dialer-proxy')
|
if (k != 'name' && k != 'dialer-proxy')
|
||||||
e.proxy[k] = p[k];
|
e.proxy[k] = p[k];
|
||||||
});
|
});
|
||||||
|
e.entry = E('select', { 'class': 'cbi-input-select', 'data-entry': p['dialer-proxy'] || '',
|
||||||
|
'title': 'через что подключаться к этому серверу, во всех профилях и на телефоне: например, через FOREIGN, ' +
|
||||||
|
'если сам сервер напрямую недоступен. «Как обычно» — как остальные свои серверы' });
|
||||||
|
entryOptions(e.entry);
|
||||||
|
e.entry.addEventListener('focus', function() { entryOptions(e.entry); });
|
||||||
|
e.entry.addEventListener('mousedown', function() { entryOptions(e.entry); });
|
||||||
|
// "как обычно" is an empty value: keep the choice for the next rebuild of the list
|
||||||
|
e.entry.addEventListener('change', function() { e.entry.setAttribute('data-entry', e.entry.value); });
|
||||||
e.name = text(S.freeName(p.name, taken()), 'имя в дашборде');
|
e.name = text(S.freeName(p.name, taken()), 'имя в дашборде');
|
||||||
e.name.style.width = '16em';
|
e.name.style.width = '16em';
|
||||||
e.get = function() {
|
e.get = function() {
|
||||||
var o = { name: e.name.value.trim() };
|
var o = { name: e.name.value.trim() };
|
||||||
Object.keys(e.proxy).forEach(function(k) { o[k] = e.proxy[k]; });
|
Object.keys(e.proxy).forEach(function(k) { o[k] = e.proxy[k]; });
|
||||||
|
if (e.entry.value)
|
||||||
|
o['dialer-proxy'] = e.entry.value;
|
||||||
return o;
|
return o;
|
||||||
};
|
};
|
||||||
var info = E('code', {}, S.summary(e.proxy));
|
var info = E('code', {}, S.summary(e.proxy));
|
||||||
@ -744,6 +802,12 @@ return view.extend({
|
|||||||
if (!v.type || v.server === undefined || v.server === null || v.server === '')
|
if (!v.type || v.server === undefined || v.server === null || v.server === '')
|
||||||
throw new Error('нужны type и server');
|
throw new Error('нужны type и server');
|
||||||
delete v.name;
|
delete v.name;
|
||||||
|
// dialer-proxy typed in the YAML: the same as the entry select
|
||||||
|
if (v['dialer-proxy']) {
|
||||||
|
e.entry.setAttribute('data-entry', v['dialer-proxy']);
|
||||||
|
e.entry.value = '';
|
||||||
|
entryOptions(e.entry);
|
||||||
|
}
|
||||||
delete v['dialer-proxy'];
|
delete v['dialer-proxy'];
|
||||||
e.proxy = v;
|
e.proxy = v;
|
||||||
e.error = null;
|
e.error = null;
|
||||||
@ -757,7 +821,7 @@ return view.extend({
|
|||||||
});
|
});
|
||||||
var el = E('div', { 'style': 'border:1px solid #8884;border-radius:4px;padding:.5em;margin-bottom:.5em' }, [
|
var el = E('div', { 'style': 'border:1px solid #8884;border-radius:4px;padding:.5em;margin-bottom:.5em' }, [
|
||||||
E('div', { 'style': 'display:flex;gap:.5em;align-items:center;flex-wrap:wrap' }, [
|
E('div', { 'style': 'display:flex;gap:.5em;align-items:center;flex-wrap:wrap' }, [
|
||||||
e.name, info,
|
e.name, info, e.entry,
|
||||||
E('button', { 'class': 'btn cbi-button', 'click': function() {
|
E('button', { 'class': 'btn cbi-button', 'click': function() {
|
||||||
e.yaml.style.display = e.yaml.style.display == 'none' ? '' : 'none';
|
e.yaml.style.display = e.yaml.style.display == 'none' ? '' : 'none';
|
||||||
} }, 'Настройки (YAML)'),
|
} }, 'Настройки (YAML)'),
|
||||||
@ -786,6 +850,49 @@ return view.extend({
|
|||||||
srvList.appendChild(el);
|
srvList.appendChild(el);
|
||||||
};
|
};
|
||||||
S.fromLines(cfg.servers_text).forEach(function(p) { addServer(p); });
|
S.fromLines(cfg.servers_text).forEach(function(p) { addServer(p); });
|
||||||
|
|
||||||
|
// [MY] nodes of the subscriptions (providers <id>-my): the same "Вход" per node
|
||||||
|
// (MY_NODE_ENTRIES). The names come from the running mihomo; saved entries show
|
||||||
|
// even when it does not run.
|
||||||
|
var myNodes = [], myNodeBox = E('div', E('em', 'загружаю ноды [MY] из подписок…'));
|
||||||
|
var addMyNode = function(provider, name, entry) {
|
||||||
|
if (myNodes.some(function(n) { return n.provider == provider && n.name == name; }))
|
||||||
|
return;
|
||||||
|
var n = { provider: provider, name: name,
|
||||||
|
entry: E('select', { 'class': 'cbi-input-select', 'data-entry': entry || '' }) };
|
||||||
|
entryOptions(n.entry);
|
||||||
|
n.entry.addEventListener('focus', function() { entryOptions(n.entry); });
|
||||||
|
n.entry.addEventListener('mousedown', function() { entryOptions(n.entry); });
|
||||||
|
n.entry.addEventListener('change', function() { n.entry.setAttribute('data-entry', n.entry.value); });
|
||||||
|
myNodes.push(n);
|
||||||
|
};
|
||||||
|
String(cfg.my_node_entries || '').split('\n').forEach(function(l) {
|
||||||
|
var m = /^([^|]*)\|([^|]*)\|(.+)$/.exec(l);
|
||||||
|
if (m)
|
||||||
|
addMyNode(m[2], m[3], m[1]);
|
||||||
|
});
|
||||||
|
var drawMyNodes = function(note) {
|
||||||
|
dom.content(myNodeBox, [ note ? E('p', { 'class': 'cbi-value-description' }, note) : '' ].concat(myNodes.length
|
||||||
|
? myNodes.map(function(n) {
|
||||||
|
return E('div', { 'style': 'display:flex;gap:.5em;align-items:center;flex-wrap:wrap;margin-bottom:.3em' },
|
||||||
|
[ E('code', n.name), E('span', { 'class': 'cbi-value-description' }, n.provider), n.entry ]);
|
||||||
|
})
|
||||||
|
: [ E('em', 'нод [MY] в подписках нет') ]));
|
||||||
|
};
|
||||||
|
callApi('/providers/proxies').then(function(r) {
|
||||||
|
if (r.error)
|
||||||
|
throw new Error(r.error);
|
||||||
|
Object.keys(r.providers || {}).sort().forEach(function(pn) {
|
||||||
|
// <id>-my and <id>-my-via-<entry> (nodes with an entry already); not the chains' <id>-my@<entry>
|
||||||
|
var m = /^(.+-my)(-via-.+)?$/.exec(pn);
|
||||||
|
if (!m || pn.indexOf('@') >= 0)
|
||||||
|
return;
|
||||||
|
(r.providers[pn].proxies || []).forEach(function(p) { addMyNode(m[1], p.name, ''); });
|
||||||
|
});
|
||||||
|
drawMyNodes('');
|
||||||
|
}).catch(function() {
|
||||||
|
drawMyNodes('nikki сейчас не работает: видны только ноды, у которых вход уже задан. Запусти профиль, чтобы увидеть все.');
|
||||||
|
});
|
||||||
// the old settings: hysteria2 by fields (HY2_*) and links (MY_LINKS) become cards,
|
// the old settings: hysteria2 by fields (HY2_*) and links (MY_LINKS) become cards,
|
||||||
// the save writes them as own servers and drops the old keys
|
// the save writes them as own servers and drops the old keys
|
||||||
var moved = 0;
|
var moved = 0;
|
||||||
@ -987,7 +1094,7 @@ return view.extend({
|
|||||||
var svcNames = {};
|
var svcNames = {};
|
||||||
var svcData = services.map(function(e) {
|
var svcData = services.map(function(e) {
|
||||||
return { name: e.name.value.trim().toLowerCase(), via: e.via.value, chain: e.chain.value, geosite: e.geosite.value.trim(),
|
return { name: e.name.value.trim().toLowerCase(), via: e.via.value, chain: e.chain.value, geosite: e.geosite.value.trim(),
|
||||||
domains: e.domains.value.trim(), ips: e.ips.value.trim(), server: e.server.value.trim(), provider: e.server.value.trim() ? e.provider.value.trim() : '' };
|
domains: e.domains.value.trim(), ips: e.ips.value.trim(), hostlist: e.hostlist.value.trim(), server: e.server.value.trim(), provider: e.server.value.trim() ? e.provider.value.trim() : '' };
|
||||||
});
|
});
|
||||||
svcData.forEach(function(v) {
|
svcData.forEach(function(v) {
|
||||||
if (!/^[a-z0-9][a-z0-9_-]*$/.test(v.name))
|
if (!/^[a-z0-9][a-z0-9_-]*$/.test(v.name))
|
||||||
@ -997,8 +1104,8 @@ return view.extend({
|
|||||||
else if (taken.test(v.name) || poolNames[v.name])
|
else if (taken.test(v.name) || poolNames[v.name])
|
||||||
errors.push('Сервис «' + v.name + '»: такая группа уже есть, возьми другое имя');
|
errors.push('Сервис «' + v.name + '»: такая группа уже есть, возьми другое имя');
|
||||||
svcNames[v.name] = true;
|
svcNames[v.name] = true;
|
||||||
if (!v.geosite && !v.domains && !v.ips)
|
if (!v.geosite && !v.domains && !v.ips && !v.hostlist)
|
||||||
errors.push('Сервис «' + v.name + '»: нужен geosite, домены или IP');
|
errors.push('Сервис «' + v.name + '»: нужен geosite, домены, IP или список доменов');
|
||||||
var builtin = /^(MY|FOREIGN|RU|DIRECT|MAIN|MY-EXIT)$/;
|
var builtin = /^(MY|FOREIGN|RU|DIRECT|MAIN|MY-EXIT)$/;
|
||||||
if (!v.server && !builtin.test(v.via) && !poolNames[v.via.toLowerCase()])
|
if (!v.server && !builtin.test(v.via) && !poolNames[v.via.toLowerCase()])
|
||||||
errors.push('Сервис «' + v.name + '»: пула ' + v.via + ' больше нет');
|
errors.push('Сервис «' + v.name + '»: пула ' + v.via + ' больше нет');
|
||||||
@ -1009,6 +1116,10 @@ return view.extend({
|
|||||||
else if (v.chain && !v.server && v.chain == v.via)
|
else if (v.chain && !v.server && v.chain == v.via)
|
||||||
errors.push('Сервис «' + v.name + '»: вход и выход — одно и то же');
|
errors.push('Сервис «' + v.name + '»: вход и выход — одно и то же');
|
||||||
});
|
});
|
||||||
|
f.bypass_clients.value.split(/\s+/).filter(Boolean).forEach(function(c) {
|
||||||
|
if (!/^\d{1,3}(\.\d{1,3}){3}(\/\d{1,2})?$/.test(c) && !/^[0-9a-f]{2}([:-][0-9a-f]{2}){5}$/i.test(c))
|
||||||
|
errors.push('Клиенты мимо mihomo: ' + c + ' — не IPv4-адрес, подсеть или MAC');
|
||||||
|
});
|
||||||
if (f.lite_gomemlimit.value.trim() && !/^[1-9][0-9]*(B|KiB|MiB|GiB)?$/.test(f.lite_gomemlimit.value.trim()))
|
if (f.lite_gomemlimit.value.trim() && !/^[1-9][0-9]*(B|KiB|MiB|GiB)?$/.test(f.lite_gomemlimit.value.trim()))
|
||||||
errors.push('Лимит памяти: число с единицей, например 64MiB');
|
errors.push('Лимит памяти: число с единицей, например 64MiB');
|
||||||
var names = {}, srvLines = [];
|
var names = {}, srvLines = [];
|
||||||
@ -1023,8 +1134,25 @@ return view.extend({
|
|||||||
errors.push('Свой сервер ' + n + ': ' + e.error);
|
errors.push('Свой сервер ' + n + ': ' + e.error);
|
||||||
else if (e.proxy.server === undefined || e.proxy.server === null || e.proxy.server === '')
|
else if (e.proxy.server === undefined || e.proxy.server === null || e.proxy.server === '')
|
||||||
errors.push('Свой сервер ' + n + ': пустой server (открой «Настройки (YAML)»)');
|
errors.push('Свой сервер ' + n + ': пустой server (открой «Настройки (YAML)»)');
|
||||||
|
// the entry: a pool that exists and does not hold the server itself (a loop)
|
||||||
|
var en = e.entry.value, ep = poolData.filter(function(v) { return v.name.toUpperCase() == en; })[0];
|
||||||
|
if (en && !/^(FOREIGN|RU|DIRECT)$/.test(en) && !ep)
|
||||||
|
errors.push('Свой сервер ' + n + ': вход через пул ' + en + ', а такого пула нет');
|
||||||
|
else if (ep && ep.servers.split(';').map(function(x) { return x.trim(); }).indexOf(n) >= 0)
|
||||||
|
errors.push('Свой сервер ' + n + ': вход через пул ' + en + ', в который он сам входит — так нельзя');
|
||||||
srvLines.push(S.toLine(e.get()));
|
srvLines.push(S.toLine(e.get()));
|
||||||
});
|
});
|
||||||
|
var nodeLines = [];
|
||||||
|
myNodes.forEach(function(n) {
|
||||||
|
var en = n.entry.value, ep = poolData.filter(function(v) { return v.name.toUpperCase() == en; })[0];
|
||||||
|
if (!en)
|
||||||
|
return;
|
||||||
|
if (!/^(FOREIGN|RU|DIRECT)$/.test(en) && !ep)
|
||||||
|
errors.push('Нода ' + n.name + ': вход через пул ' + en + ', а такого пула нет');
|
||||||
|
else if (ep && ep.subs.split(/\s+/).indexOf(n.provider) >= 0)
|
||||||
|
errors.push('Нода ' + n.name + ': вход через пул ' + en + ', который сам берёт ноды ' + n.provider + ' — так нельзя');
|
||||||
|
nodeLines.push(en + '|' + n.provider + '|' + n.name);
|
||||||
|
});
|
||||||
if (errors.length) {
|
if (errors.length) {
|
||||||
ui.addNotification(null, errors.map(function(e) { return E('p', e); }), 'danger');
|
ui.addNotification(null, errors.map(function(e) { return E('p', e); }), 'danger');
|
||||||
return;
|
return;
|
||||||
@ -1044,6 +1172,7 @@ return view.extend({
|
|||||||
foreign_domains: f.foreign_domains.value.trim(),
|
foreign_domains: f.foreign_domains.value.trim(),
|
||||||
my_domains: f.my_domains.value.trim(),
|
my_domains: f.my_domains.value.trim(),
|
||||||
local_hosts: f.local_hosts.value.trim(),
|
local_hosts: f.local_hosts.value.trim(),
|
||||||
|
bypass_clients: f.bypass_clients.value.trim(),
|
||||||
my_links: '',
|
my_links: '',
|
||||||
openvpn: f.openvpn.checked,
|
openvpn: f.openvpn.checked,
|
||||||
csqtt: f.csqtt.checked,
|
csqtt: f.csqtt.checked,
|
||||||
@ -1065,7 +1194,8 @@ return view.extend({
|
|||||||
hy2: [],
|
hy2: [],
|
||||||
services: svcData,
|
services: svcData,
|
||||||
pools: poolData,
|
pools: poolData,
|
||||||
servers_text: srvLines.join('\n')
|
servers_text: srvLines.join('\n'),
|
||||||
|
my_node_entries: nodeLines.join('\n')
|
||||||
});
|
});
|
||||||
}, this)).then(L.bind(function(r) {
|
}, this)).then(L.bind(function(r) {
|
||||||
if (r.error) {
|
if (r.error) {
|
||||||
@ -1157,7 +1287,11 @@ return view.extend({
|
|||||||
field('Доп. IP через MY', f.my_ips, 'свои серверы (вкладка «Свои серверы») и [MY] из подписок'),
|
field('Доп. IP через MY', f.my_ips, 'свои серверы (вкладка «Свои серверы») и [MY] из подписок'),
|
||||||
field('Локальные адреса', f.local_hosts, 'домен=IP в локальной сети (с поддоменами): роутер и клиенты ' +
|
field('Локальные адреса', f.local_hosts, 'домен=IP в локальной сети (с поддоменами): роутер и клиенты ' +
|
||||||
'ходят к серверу напрямую по LAN, а не через белый IP и обратно. Только для этого роутера (не телефон, ' +
|
'ходят к серверу напрямую по LAN, а не через белый IP и обратно. Только для этого роутера (не телефон, ' +
|
||||||
'при импорте не переносится)')
|
'при импорте не переносится)'),
|
||||||
|
field('Клиенты мимо mihomo', f.bypass_clients, 'IP-адреса (или подсети) и MAC-адреса устройств в локальной сети ' +
|
||||||
|
'через пробел: их трафик и DNS идут напрямую, без обхода. Например, второй роутер со своим kit за этим — иначе ' +
|
||||||
|
'его трафик дважды идёт через прокси. MAC надёжнее: IP может смениться (или закрепи IP в Сеть → DHCP и DNS). ' +
|
||||||
|
'Только для этого роутера')
|
||||||
]);
|
]);
|
||||||
put('servers', [
|
put('servers', [
|
||||||
E('p', { 'class': 'cbi-value-description' }, 'Собираются в группу MY (автовыбор самого быстрого, в дашборде можно закрепить один). MY — пункт в MAIN ' +
|
E('p', { 'class': 'cbi-value-description' }, 'Собираются в группу MY (автовыбор самого быстрого, в дашборде можно закрепить один). MY — пункт в MAIN ' +
|
||||||
@ -1176,7 +1310,12 @@ return view.extend({
|
|||||||
E('button', { 'class': 'btn cbi-button', 'click': function() {
|
E('button', { 'class': 'btn cbi-button', 'click': function() {
|
||||||
addServer({ name: 'new', type: 'hysteria2', server: '', port: 443, password: '' }, true);
|
addServer({ name: 'new', type: 'hysteria2', server: '', port: 443, password: '' }, true);
|
||||||
} }, 'Добавить вручную')
|
} }, 'Добавить вручную')
|
||||||
])
|
]),
|
||||||
|
E('h4', 'Из подписок ([MY])'),
|
||||||
|
E('p', { 'class': 'cbi-value-description' }, 'Серверы, которые ты держишь в своей подписке с [MY] в имени: их настройки ' +
|
||||||
|
'приходят из подписки, но вход можно задать здесь — для каждого отдельно, как у своих серверов выше. ' +
|
||||||
|
'Нода ищется по точному имени: если в подписке её переименуют, вход перестанет действовать.'),
|
||||||
|
myNodeBox
|
||||||
]);
|
]);
|
||||||
// one button for every tab: the settings are saved and applied together
|
// one button for every tab: the settings are saved and applied together
|
||||||
dom.content(this.saveBox, E('div', { 'class': 'cbi-page-actions' }, [
|
dom.content(this.saveBox, E('div', { 'class': 'cbi-page-actions' }, [
|
||||||
|
|||||||
55
luci/rpcd.sh
55
luci/rpcd.sh
@ -16,9 +16,10 @@
|
|||||||
# config_get settings for the form (secrets: only whether they are set)
|
# config_get settings for the form (secrets: only whether they are set)
|
||||||
# config_set save the form (via "mihomo-kit.sh configure") as the job
|
# config_set save the form (via "mihomo-kit.sh configure") as the job
|
||||||
# graph {profile}: the built profile's YAML for the graph page (default: the running one)
|
# graph {profile}: the built profile's YAML for the graph page (default: the running one)
|
||||||
# and the services and pools of the settings (+ servers, subs: what a pool can take)
|
# and the services and pools of the settings (+ servers, subs: what a pool can take;
|
||||||
|
# hostlists: the zapret lists a service can take)
|
||||||
# api {path}: GET /proxies, /connections or /providers/proxies of the mihomo API
|
# api {path}: GET /proxies, /connections or /providers/proxies of the mihomo API
|
||||||
# services_set {services: [{name, geosite, domains, ips, via, chain}], pools: [{name, type, servers,
|
# services_set {services: [{name, geosite, domains, ips, via, chain, server, provider, hostlist}], pools: [{name, type, servers,
|
||||||
# subs, filter, exclude, uplink}]}: replace the services and pools ("mihomo-kit.sh services")
|
# subs, filter, exclude, uplink}]}: replace the services and pools ("mihomo-kit.sh services")
|
||||||
# as the job
|
# as the job
|
||||||
# group {group, action, name, url}: select (pick / pin name), unfix (back to automatic),
|
# group {group, action, name, url}: select (pick / pin name), unfix (back to automatic),
|
||||||
@ -292,8 +293,19 @@ m_config_get() {
|
|||||||
json_add_string foreign_domains "${FOREIGN_DOMAINS:-}"
|
json_add_string foreign_domains "${FOREIGN_DOMAINS:-}"
|
||||||
json_add_string my_domains "${MY_DOMAINS:-}"
|
json_add_string my_domains "${MY_DOMAINS:-}"
|
||||||
json_add_string local_hosts "${LOCAL_HOSTS:-}"
|
json_add_string local_hosts "${LOCAL_HOSTS:-}"
|
||||||
blocks_json services "${SERVICES:-}" SVC geosite domains ips via chain server provider
|
json_add_string bypass_clients "${BYPASS_CLIENTS:-}"
|
||||||
|
# [MY] nodes of the subscriptions with an entry of their own: "<ENTRY>|<id>-my|<name>" lines
|
||||||
|
# (MY_NODE_1, MY_NODE_2, ... in common.env)
|
||||||
|
json_add_string my_node_entries "$(
|
||||||
|
_mk=1
|
||||||
|
while eval "[ -n \"\${MY_NODE_$_mk+x}\" ]"; do
|
||||||
|
eval "printf '%s\n' \"\$MY_NODE_$_mk\""
|
||||||
|
_mk=$((_mk + 1))
|
||||||
|
done
|
||||||
|
)"
|
||||||
|
blocks_json services "${SERVICES:-}" SVC geosite domains ips via chain server provider hostlist
|
||||||
blocks_json pools "${POOLS:-}" POOL type servers subs filter exclude uplink
|
blocks_json pools "${POOLS:-}" POOL type servers subs filter exclude uplink
|
||||||
|
hostlist_files
|
||||||
# own servers: one JSON proxy per line (luci/servers.js); the old hy2 / my_links
|
# own servers: one JSON proxy per line (luci/servers.js); the old hy2 / my_links
|
||||||
# below are moved into it by the page on the next save
|
# below are moved into it by the page on the next save
|
||||||
json_add_string servers_text "$(cat "$NIKKI_DIR/my-servers" 2>/dev/null)"
|
json_add_string servers_text "$(cat "$NIKKI_DIR/my-servers" 2>/dev/null)"
|
||||||
@ -339,7 +351,7 @@ m_config_get() {
|
|||||||
|
|
||||||
# {"data": {boot_links (one per line), subs: [{url, via, hwid}], hwid_*, torrent, push, ru_ips,
|
# {"data": {boot_links (one per line), subs: [{url, via, hwid}], hwid_*, torrent, push, ru_ips,
|
||||||
# foreign_ips, my_ips, ru_domains, foreign_domains, my_domains, local_hosts, my_links (one per line),
|
# foreign_ips, my_ips, ru_domains, foreign_domains, my_domains, local_hosts, my_links (one per line),
|
||||||
# services: [{name, geosite, domains, ips, via, chain}], pools: [{name, type, servers, subs, filter, exclude, uplink}],
|
# services: [{name, geosite, domains, ips, via, chain, server, provider, hostlist}], pools: [{name, type, servers, subs, filter, exclude, uplink}],
|
||||||
# servers_text (own servers, one JSON proxy per line: written to /etc/nikki/my-servers),
|
# servers_text (own servers, one JSON proxy per line: written to /etc/nikki/my-servers),
|
||||||
# openvpn, csqtt, ovpn (file text, optional), vpn_username, vpn_password, totp_secret,
|
# openvpn, csqtt, ovpn (file text, optional), vpn_username, vpn_password, totp_secret,
|
||||||
# totp_clear (1: no codes any more), pass_format, ovpn_routes (only from a page that has it),
|
# totp_clear (1: no codes any more), pass_format, ovpn_routes (only from a page that has it),
|
||||||
@ -419,7 +431,17 @@ m_config_set() {
|
|||||||
echo "TOTP_SECRET=$(q "$totp_secret")"
|
echo "TOTP_SECRET=$(q "$totp_secret")"
|
||||||
fi
|
fi
|
||||||
case "$pass_format" in auto | scrv1 | otp-last | otp-first) echo "PASS_FORMAT=$pass_format" ;; esac
|
case "$pass_format" in auto | scrv1 | otp-last | otp-first) echo "PASS_FORMAT=$pass_format" ;; esac
|
||||||
# an old cached page does not send it: the saved one stays
|
# an old cached page does not send these: the saved ones stay
|
||||||
|
json_get_type _bc bypass_clients
|
||||||
|
if [ -n "$_bc" ]; then
|
||||||
|
json_get_var bypass_clients bypass_clients ""
|
||||||
|
echo "BYPASS_CLIENTS=$(q "$(echo $bypass_clients)")"
|
||||||
|
fi
|
||||||
|
json_get_type _me my_node_entries
|
||||||
|
if [ -n "$_me" ]; then
|
||||||
|
json_get_var my_node_entries my_node_entries ""
|
||||||
|
echo "MY_NODE_ENTRIES=$(q "$my_node_entries")"
|
||||||
|
fi
|
||||||
json_get_type _rt ovpn_routes
|
json_get_type _rt ovpn_routes
|
||||||
if [ -n "$_rt" ]; then
|
if [ -n "$_rt" ]; then
|
||||||
json_get_var ovpn_routes ovpn_routes ""
|
json_get_var ovpn_routes ovpn_routes ""
|
||||||
@ -454,7 +476,7 @@ m_config_set() {
|
|||||||
json_select ..
|
json_select ..
|
||||||
fi
|
fi
|
||||||
echo "HY2=$(q "$hy2")"
|
echo "HY2=$(q "$hy2")"
|
||||||
blocks_env services SERVICES SVC geosite domains ips via chain server provider
|
blocks_env services SERVICES SVC geosite domains ips via chain server provider hostlist
|
||||||
blocks_env pools POOLS POOL type servers subs filter exclude uplink
|
blocks_env pools POOLS POOL type servers subs filter exclude uplink
|
||||||
} > "$env"
|
} > "$env"
|
||||||
umask 022
|
umask 022
|
||||||
@ -508,6 +530,22 @@ blocks_env() {
|
|||||||
echo "$_var=$(q "$_names")"
|
echo "$_var=$(q "$_names")"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# zapret hostlists a service can take (SVC_<NAME>_HOSTLIST): [{path, lines}] - the
|
||||||
|
# domain lists of zapret2 / zapret (not the exclude lists, not the IP sets)
|
||||||
|
hostlist_files() {
|
||||||
|
json_add_array hostlists
|
||||||
|
for f in /opt/zapret2/ipset/* /opt/zapret/ipset/*; do
|
||||||
|
[ -f "$f" ] || continue
|
||||||
|
case "${f##*/}" in *exclude*) continue ;; *host*.txt | *host*.txt.gz | *host*.lst) ;; *) continue ;; esac
|
||||||
|
json_add_object ""
|
||||||
|
json_add_string path "$f"
|
||||||
|
case "$f" in *.gz) n=$(gzip -dc "$f" 2>/dev/null | grep -c '^[^#]') ;; *) n=$(grep -c '^[^#]' "$f") ;; esac
|
||||||
|
json_add_int lines "${n:-0}"
|
||||||
|
json_close_object
|
||||||
|
done
|
||||||
|
json_close_array
|
||||||
|
}
|
||||||
|
|
||||||
# what a pool can take: own servers by name, providers of the subscriptions ("<id>", "<id>-my")
|
# what a pool can take: own servers by name, providers of the subscriptions ("<id>", "<id>-my")
|
||||||
pool_sources() {
|
pool_sources() {
|
||||||
# not a pipe: json_add_* must run in this shell
|
# not a pipe: json_add_* must run in this shell
|
||||||
@ -545,8 +583,9 @@ m_graph() {
|
|||||||
json_add_string yaml "$(cat "$NIKKI_DIR/profiles/$want.yaml")"
|
json_add_string yaml "$(cat "$NIKKI_DIR/profiles/$want.yaml")"
|
||||||
# the services and pools, as config_get gives them, and what a pool can take: the graph edits these
|
# the services and pools, as config_get gives them, and what a pool can take: the graph edits these
|
||||||
[ -f "$PROFILES_D/common.env" ] && . "$PROFILES_D/common.env"
|
[ -f "$PROFILES_D/common.env" ] && . "$PROFILES_D/common.env"
|
||||||
blocks_json services "${SERVICES:-}" SVC geosite domains ips via chain server provider
|
blocks_json services "${SERVICES:-}" SVC geosite domains ips via chain server provider hostlist
|
||||||
blocks_json pools "${POOLS:-}" POOL type servers subs filter exclude uplink
|
blocks_json pools "${POOLS:-}" POOL type servers subs filter exclude uplink
|
||||||
|
hostlist_files
|
||||||
pool_sources
|
pool_sources
|
||||||
json_dump
|
json_dump
|
||||||
}
|
}
|
||||||
@ -557,7 +596,7 @@ m_services_set() {
|
|||||||
umask 077
|
umask 077
|
||||||
env=$(mktemp /tmp/mihomo-kit-svc.XXXXXX) || reply_error "mktemp failed"
|
env=$(mktemp /tmp/mihomo-kit-svc.XXXXXX) || reply_error "mktemp failed"
|
||||||
{
|
{
|
||||||
blocks_env services SERVICES SVC geosite domains ips via chain server provider
|
blocks_env services SERVICES SVC geosite domains ips via chain server provider hostlist
|
||||||
blocks_env pools POOLS POOL type servers subs filter exclude uplink
|
blocks_env pools POOLS POOL type servers subs filter exclude uplink
|
||||||
} > "$env"
|
} > "$env"
|
||||||
umask 022
|
umask 022
|
||||||
|
|||||||
@ -1654,13 +1654,14 @@
|
|||||||
return { servers: servers, errors: errors };
|
return { servers: servers, errors: errors };
|
||||||
}
|
}
|
||||||
|
|
||||||
// one stored line: JSON with "name" first (mihomo-kit.sh reads it with sed), no
|
// one stored line: JSON with "name" first (mihomo-kit.sh reads it with sed), a
|
||||||
// dialer-proxy (the kit sets it per profile), "$" as \u0024 (no ${...} for the
|
// dialer-proxy only as the server's own entry (LuCI "Вход"; otherwise the kit sets
|
||||||
// template engine; JSON and YAML both read \u escapes)
|
// it per profile), "$" as \u0024 (no ${...} for the template engine; JSON and YAML
|
||||||
|
// both read \u escapes)
|
||||||
function toLine(p) {
|
function toLine(p) {
|
||||||
var o = { name: String(p.name) };
|
var o = { name: String(p.name) };
|
||||||
Object.keys(p).forEach(function (k) {
|
Object.keys(p).forEach(function (k) {
|
||||||
if (k != 'name' && k != 'dialer-proxy')
|
if (k != 'name' && (k != 'dialer-proxy' || p[k]))
|
||||||
o[k] = p[k];
|
o[k] = p[k];
|
||||||
});
|
});
|
||||||
return JSON.stringify(o).replace(/\$/g, '\\u0024');
|
return JSON.stringify(o).replace(/\$/g, '\\u0024');
|
||||||
|
|||||||
@ -50,6 +50,9 @@ PROFILES_OUT="$NIKKI_DIR/profiles"
|
|||||||
# An explicit MIHOMO_VERSION in kit.env wins (e.g. MIHOMO_VERSION=v1.19.29).
|
# An explicit MIHOMO_VERSION in kit.env wins (e.g. MIHOMO_VERSION=v1.19.29).
|
||||||
CORE_OFFICIAL=v1.19.34
|
CORE_OFFICIAL=v1.19.34
|
||||||
CORE_KIT=v1.19.34-ts8
|
CORE_KIT=v1.19.34-ts8
|
||||||
|
# nikki packages (install): the OpenWrt-nikki release NIKKI_VERSION, mirrored into the
|
||||||
|
# kit repo's releases (tools/nikki-mirror.sh) - GitHub is often unreachable from the router
|
||||||
|
NIKKI_VERSION=v1.26.2
|
||||||
STOCK_CORE=/usr/libexec/mihomo
|
STOCK_CORE=/usr/libexec/mihomo
|
||||||
KIT_ENV=${KIT_ENV:-/etc/nikki/kit.env}
|
KIT_ENV=${KIT_ENV:-/etc/nikki/kit.env}
|
||||||
[ -f "$KIT_ENV" ] && . "$KIT_ENV"
|
[ -f "$KIT_ENV" ] && . "$KIT_ENV"
|
||||||
@ -69,6 +72,8 @@ case "$MIHOMO_VERSION" in
|
|||||||
*) : "${MIHOMO_BASE:=https://github.com/MetaCubeX/mihomo/releases/download/$MIHOMO_VERSION}" ;;
|
*) : "${MIHOMO_BASE:=https://github.com/MetaCubeX/mihomo/releases/download/$MIHOMO_VERSION}" ;;
|
||||||
esac
|
esac
|
||||||
: "${KIT_URL:=https://git.sam-hub.net/sam/mihomo-kit/archive/main.tar.gz}"
|
: "${KIT_URL:=https://git.sam-hub.net/sam/mihomo-kit/archive/main.tar.gz}"
|
||||||
|
# where nikki_<arch>-<branch>.tar.gz is downloaded from, tried in this order
|
||||||
|
: "${NIKKI_BASES:=https://git.sam-hub.net/sam/mihomo-kit/releases/download/nikki-$NIKKI_VERSION https://github.com/nikkinikki-org/OpenWrt-nikki/releases/download/$NIKKI_VERSION}"
|
||||||
|
|
||||||
log() { echo "$*" >&2; }
|
log() { echo "$*" >&2; }
|
||||||
die() { log "error: $*"; exit 1; }
|
die() { log "error: $*"; exit 1; }
|
||||||
@ -178,6 +183,8 @@ compute_tags() {
|
|||||||
case "$TAGS" in *" router "*" whitelist "* | *" router "*" foreign "*) TAGS="$TAGS ovpn_exit " ;; esac
|
case "$TAGS" in *" router "*" whitelist "* | *" router "*" foreign "*) TAGS="$TAGS ovpn_exit " ;; esac
|
||||||
# own servers through MY-EXIT: whitelist and the phone (often on whitelists)
|
# own servers through MY-EXIT: whitelist and the phone (often on whitelists)
|
||||||
case "$TAGS" in *" whitelist "* | *" mobile "*) TAGS="$TAGS my_exit " ;; esac
|
case "$TAGS" in *" whitelist "* | *" mobile "*) TAGS="$TAGS my_exit " ;; esac
|
||||||
|
# MY_SUB_BASE: the same without the providers of nodes with an entry (my_node_vars)
|
||||||
|
MY_SUB_BASE=$MY_SUB_LIST
|
||||||
export SUB_LIST MY_SUB_LIST CSQTT_MAIN
|
export SUB_LIST MY_SUB_LIST CSQTT_MAIN
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -358,6 +365,8 @@ sub_vars() {
|
|||||||
_h="x-device-os=$HWID_OS;x-ver-os=$HWID_OS_VER;x-device-model=$HWID_MODEL;x-hwid=$HWID_ID${_h:+;$_h}"
|
_h="x-device-os=$HWID_OS;x-ver-os=$HWID_OS_VER;x-device-model=$HWID_MODEL;x-hwid=$HWID_ID${_h:+;$_h}"
|
||||||
fi
|
fi
|
||||||
SUB_PROXY=$_p
|
SUB_PROXY=$_p
|
||||||
|
SUB_MY_EXCLUDE=""
|
||||||
|
[ -n "${MY_NODE_ENTRIES:-}" ] && SUB_MY_EXCLUDE=$(yq "$(my_node_re "$2")")
|
||||||
SUB_UA=$(yq "${_ua:-mihomo}")
|
SUB_UA=$(yq "${_ua:-mihomo}")
|
||||||
SUB_HEADERS=""
|
SUB_HEADERS=""
|
||||||
_old_ifs=$IFS
|
_old_ifs=$IFS
|
||||||
@ -373,7 +382,7 @@ sub_vars() {
|
|||||||
done
|
done
|
||||||
set +f
|
set +f
|
||||||
IFS=$_old_ifs
|
IFS=$_old_ifs
|
||||||
export SUB_NAME SUB_URL SUB_PROXY SUB_UA SUB_HEADERS
|
export SUB_NAME SUB_URL SUB_PROXY SUB_UA SUB_HEADERS SUB_MY_EXCLUDE
|
||||||
}
|
}
|
||||||
|
|
||||||
# hy2_json <name>: an old own hysteria2 server of the settings (HY2_<NAME>_SERVER, _PORT,
|
# hy2_json <name>: an old own hysteria2 server of the settings (HY2_<NAME>_SERVER, _PORT,
|
||||||
@ -395,12 +404,14 @@ hy2_json() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Own servers (LuCI "Свои серверы"): MY_SERVERS_FILE holds one JSON proxy per line
|
# Own servers (LuCI "Свои серверы"): MY_SERVERS_FILE holds one JSON proxy per line
|
||||||
# with "name" first (luci/servers.js), plus the old HY2_* keys -> OWN_BODIES, the
|
# with "name" first (luci/servers.js), plus the old HY2_* keys -> OWN_PLAIN, the lines
|
||||||
# lines without the leading "{" (templates/proxies puts dialer-proxy in front), and
|
# without an entry of their own and without the leading "{" (templates/proxies puts the
|
||||||
# OWN_LIST '"a", "b"' for group MY. "$" becomes \u0024: the template engine would read
|
# kit's dialer-proxy in front), OWN_ENTRY, the lines with one (LuCI "Вход": their own
|
||||||
|
# "dialer-proxy", kept in every profile), OWN_BODIES, all lines as OWN_PLAIN (for the
|
||||||
|
# chains' copies, which dial through their entry), and OWN_LIST '"a", "b"' for group MY. "$" becomes \u0024: the template engine would read
|
||||||
# ${...} in a password, JSON and YAML both read the escape.
|
# ${...} in a password, JSON and YAML both read the escape.
|
||||||
own_servers_vars() {
|
own_servers_vars() {
|
||||||
OWN_BODIES="" OWN_LIST="" OWN_NAMES=""
|
OWN_BODIES="" OWN_PLAIN="" OWN_ENTRY="" OWN_LIST="" OWN_NAMES=""
|
||||||
_lines=$(
|
_lines=$(
|
||||||
[ -f "$MY_SERVERS_FILE" ] && grep -v '^[[:space:]]*$' "$MY_SERVERS_FILE"
|
[ -f "$MY_SERVERS_FILE" ] && grep -v '^[[:space:]]*$' "$MY_SERVERS_FILE"
|
||||||
for _n in $HY2; do hy2_json "$_n"; done
|
for _n in $HY2; do hy2_json "$_n"; done
|
||||||
@ -412,10 +423,96 @@ own_servers_vars() {
|
|||||||
_dup=$(printf '%s\n' "$_names" | sort | uniq -d | head -n 1)
|
_dup=$(printf '%s\n' "$_names" | sort | uniq -d | head -n 1)
|
||||||
[ -z "$_dup" ] || die "own servers: the name $_dup repeats"
|
[ -z "$_dup" ] || die "own servers: the name $_dup repeats"
|
||||||
OWN_NAMES=$_names
|
OWN_NAMES=$_names
|
||||||
OWN_BODIES=$(printf '%s\n' "$_lines" | sed 's/^{//; s/\$/\\u0024/g')
|
OWN_BODIES=$(printf '%s\n' "$_lines" | sed 's/^{//; s/,"dialer-proxy":"[^"]*"//; s/\$/\\u0024/g')
|
||||||
|
OWN_PLAIN=$(printf '%s\n' "$_lines" | grep -v '"dialer-proxy":' | sed 's/^{//; s/\$/\\u0024/g')
|
||||||
|
OWN_ENTRY=$(printf '%s\n' "$_lines" | grep '"dialer-proxy":' | sed 's/^/- /; s/\$/\\u0024/g')
|
||||||
OWN_LIST=$(printf '%s\n' "$_names" | sed 's/\$/\\u0024/g' | awk '{ printf "%s%s", (NR > 1 ? ", " : ""), $0 }')
|
OWN_LIST=$(printf '%s\n' "$_names" | sed 's/\$/\\u0024/g' | awk '{ printf "%s%s", (NR > 1 ? ", " : ""), $0 }')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# [MY] nodes of the subscriptions with an entry of their own (LuCI «Свои серверы» →
|
||||||
|
# «Вход»): MY_NODE_ENTRIES, one "<ENTRY>|<id>-my|<exact node name>" per line, stored in
|
||||||
|
# common.env as MY_NODE_1, MY_NODE_2, ... (one line each: my_nodes_join). Such a node
|
||||||
|
# leaves the provider <id>-my (its exclude-filter, SUB_MY_EXCLUDE) for <id>-my-via-<ENTRY>
|
||||||
|
# (providers/16-myvia: the same file, only these nodes, dialer-proxy <ENTRY> in every
|
||||||
|
# profile), which goes wherever <id>-my goes (my_via_expand). MYVIA_ITEMS "<id>|<ENTRY>".
|
||||||
|
my_node_vars() {
|
||||||
|
MYVIA_ITEMS=""
|
||||||
|
: "${MY_NODE_ENTRIES:=$(my_nodes_join)}"
|
||||||
|
[ -n "$MY_NODE_ENTRIES" ] || return 0
|
||||||
|
MYVIA_ITEMS=$(printf '%s\n' "$MY_NODE_ENTRIES" | while IFS='|' read -r _me _mp _mn; do
|
||||||
|
[ -n "$_me" ] && [ -n "$_mn" ] || continue
|
||||||
|
case "$_mp" in *-my) ;; *) die "MY_NODE_ENTRIES: $_mp is not a provider of [MY] nodes (<id>-my)" ;; esac
|
||||||
|
# a subscription that is off: its nodes are not in the profile
|
||||||
|
case ", $MY_SUB_BASE, " in *", $_mp, "*) echo "${_mp%-my}|$_me" ;; esac
|
||||||
|
done | awk '!seen[$0]++') || exit 1
|
||||||
|
[ -n "$MYVIA_ITEMS" ] || return 0
|
||||||
|
TAGS="$TAGS myvia "
|
||||||
|
MY_SUB_LIST=$(my_via_expand "$MY_SUB_BASE")
|
||||||
|
export MY_SUB_LIST
|
||||||
|
}
|
||||||
|
|
||||||
|
# my_nodes_join: MY_NODE_1, MY_NODE_2, ... of the settings, one per line
|
||||||
|
my_nodes_join() {
|
||||||
|
_mk=1
|
||||||
|
while eval "[ -n \"\${MY_NODE_$_mk+x}\" ]"; do
|
||||||
|
eval "printf '%s\\n' \"\$MY_NODE_$_mk\""
|
||||||
|
_mk=$((_mk + 1))
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# my_via_expand "a-my, b, ...": the list with <id>-my-via-<ENTRY> after each <id>-my
|
||||||
|
my_via_expand() {
|
||||||
|
[ -n "$MYVIA_ITEMS" ] || { printf '%s' "$1"; return; }
|
||||||
|
printf '%s\n' "$1" | tr ',' '\n' | sed 's/^ *//' | while read -r _vp; do
|
||||||
|
[ -n "$_vp" ] || continue
|
||||||
|
echo "$_vp"
|
||||||
|
case "$_vp" in *-my) printf '%s\n' "$MYVIA_ITEMS" | awk -F'|' -v id="${_vp%-my}" '$1 == id { print $1 "-my-via-" $2 }' ;; esac
|
||||||
|
done | awk '{ printf "%s%s", (NR > 1 ? ", " : ""), $0 }'
|
||||||
|
}
|
||||||
|
|
||||||
|
# my_node_re <id> [ENTRY]: the exact names of its [MY] nodes with an entry (that one) as
|
||||||
|
# one anchored regex, literal (backtick separates filters in mihomo: encoded); nothing if none
|
||||||
|
my_node_re() {
|
||||||
|
printf '%s\n' "${MY_NODE_ENTRIES:-}" | awk -F'|' -v p="$1-my" -v e="${2:-}" '
|
||||||
|
$2 == p && (e == "" || $1 == e) { n = $0; sub(/^[^|]*\|[^|]*\|/, "", n); if (n != "") print n }' |
|
||||||
|
sed 's/[][\\.^$*+?(){}|]/\\&/g; s/`/\\x60/g' | awk '{ printf "%s%s", (NR > 1 ? "|" : "^("), $0 } END { if (NR) print ")$" }'
|
||||||
|
}
|
||||||
|
|
||||||
|
# myvia_vars "<id>|<ENTRY>": MV_NAME MV_ENTRY MV_FILTER (+ the subscription's SUB_* for the phone)
|
||||||
|
myvia_vars() {
|
||||||
|
_mid=${1%%|*} MV_ENTRY=${1#*|}
|
||||||
|
MV_NAME="$_mid-my-via-$MV_ENTRY"
|
||||||
|
MV_FILTER=$(yq "$(my_node_re "$_mid" "$MV_ENTRY")")
|
||||||
|
_i=0
|
||||||
|
for _pr in $SUB_PAIRS; do
|
||||||
|
[ "${_pr%%=*}" = "$_mid" ] && sub_vars "$_i" "$_mid" "${_pr#*=}"
|
||||||
|
_i=$((_i + 1))
|
||||||
|
done
|
||||||
|
export MV_NAME MV_ENTRY MV_FILTER
|
||||||
|
}
|
||||||
|
|
||||||
|
# own_entries_check (after pools_vars): an own server's entry is FOREIGN, RU, DIRECT
|
||||||
|
# or a pool that does not hold the server itself (that would be a loop)
|
||||||
|
own_entries_check() {
|
||||||
|
printf '%s\n' "$OWN_ENTRY" | sed -nE 's/^- \{"name":("([^"\\]|\\.)*"),.*"dialer-proxy":"([^"]*)".*/\3 \1/p' |
|
||||||
|
while read -r _oe _on; do
|
||||||
|
case " FOREIGN RU DIRECT$POOL_GROUPS" in *" $_oe "*) ;; *) die "own server $_on: entry $_oe is not FOREIGN, RU, DIRECT or a pool" ;; esac
|
||||||
|
case "$_oe" in FOREIGN | RU | DIRECT) continue ;; esac
|
||||||
|
# pool_vars sets _n, _e and others of its own
|
||||||
|
pool_vars "$(printf '%s' "$_oe" | tr 'A-Z' 'a-z')"
|
||||||
|
printf '%s\n' "$POOL_JSON" | grep -qxF "$_on" && die "own server $_on: its entry is the pool $_oe that holds it (a loop)"
|
||||||
|
true
|
||||||
|
done || exit 1
|
||||||
|
# [MY] nodes: the same entries; a pool with their subscription's [MY] nodes would be a loop
|
||||||
|
printf '%s\n' "$MYVIA_ITEMS" | while IFS='|' read -r _mi _oe; do
|
||||||
|
[ -n "$_mi" ] || continue
|
||||||
|
case " FOREIGN RU DIRECT$POOL_GROUPS" in *" $_oe "*) ;; *) die "[MY] nodes of $_mi: entry $_oe is not FOREIGN, RU, DIRECT or a pool" ;; esac
|
||||||
|
case "$_oe" in FOREIGN | RU | DIRECT) continue ;; esac
|
||||||
|
pool_vars "$(printf '%s' "$_oe" | tr 'A-Z' 'a-z')"
|
||||||
|
case ", $POOL_USE_BASE, " in *", $_mi-my, "*) die "[MY] nodes of $_mi: their entry is the pool $_oe that takes them (a loop)" ;; esac
|
||||||
|
done || exit 1
|
||||||
|
}
|
||||||
|
|
||||||
# Services (SERVICES="claude ..."): a site or app that always takes its own way, with
|
# Services (SERVICES="claude ..."): a site or app that always takes its own way, with
|
||||||
# a group of its own in the dashboard. Per service, keys SVC_<NAME>_* (upper case, - -> _):
|
# a group of its own in the dashboard. Per service, keys SVC_<NAME>_* (upper case, - -> _):
|
||||||
# _GEOSITE geosite lists of MetaCubeX/meta-rules-dat (GEOSITE_URL), e.g. "anthropic"
|
# _GEOSITE geosite lists of MetaCubeX/meta-rules-dat (GEOSITE_URL), e.g. "anthropic"
|
||||||
@ -466,11 +563,14 @@ pool_vars() {
|
|||||||
done
|
done
|
||||||
IFS=$_old_ifs
|
IFS=$_old_ifs
|
||||||
for _p in $_su; do
|
for _p in $_su; do
|
||||||
case ", $SUB_LIST, $MY_SUB_LIST, " in
|
case ", $SUB_LIST, $MY_SUB_BASE, " in
|
||||||
*", $_p, "*) POOL_USE="${POOL_USE:+$POOL_USE, }$_p" ;;
|
*", $_p, "*) POOL_USE="${POOL_USE:+$POOL_USE, }$_p" ;;
|
||||||
*) POOL_DROPPED="${POOL_DROPPED:+$POOL_DROPPED, }$_p" ;;
|
*) POOL_DROPPED="${POOL_DROPPED:+$POOL_DROPPED, }$_p" ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
# the chains' copies take every [MY] node from <id>-my@<entry>: without the via providers
|
||||||
|
POOL_USE_BASE=$POOL_USE
|
||||||
|
POOL_USE=$(my_via_expand "$POOL_USE")
|
||||||
if [ -z "$POOL_PROXIES$POOL_USE" ]; then
|
if [ -z "$POOL_PROXIES$POOL_USE" ]; then
|
||||||
POOL_PROXIES=REJECT
|
POOL_PROXIES=REJECT
|
||||||
POOL_TYPE=select
|
POOL_TYPE=select
|
||||||
@ -535,10 +635,10 @@ variant_add() {
|
|||||||
variant_members() {
|
variant_members() {
|
||||||
_pfixed=0
|
_pfixed=0
|
||||||
if [ "$1" = MY ]; then
|
if [ "$1" = MY ]; then
|
||||||
_vm_json=$OWN_NAMES _vm_use=$MY_SUB_LIST _vm_type=fallback _vm_filter="" _vm_exclude=""
|
_vm_json=$OWN_NAMES _vm_use=$MY_SUB_BASE _vm_type=fallback _vm_filter="" _vm_exclude=""
|
||||||
else
|
else
|
||||||
pool_vars "$(printf '%s' "$1" | tr 'A-Z' 'a-z')"
|
pool_vars "$(printf '%s' "$1" | tr 'A-Z' 'a-z')"
|
||||||
_vm_json=$POOL_JSON _vm_use=$POOL_USE _vm_type=$POOL_TYPE _vm_filter=$POOL_FILTER _vm_exclude=$POOL_EXCLUDE
|
_vm_json=$POOL_JSON _vm_use=$POOL_USE_BASE _vm_type=$POOL_TYPE _vm_filter=$POOL_FILTER _vm_exclude=$POOL_EXCLUDE
|
||||||
if [ "$_pfixed" = 1 ] && [ -n "$_fi" ] && [ -n "${VM_ENTRY:-}" ]; then
|
if [ "$_pfixed" = 1 ] && [ -n "$_fi" ] && [ -n "${VM_ENTRY:-}" ]; then
|
||||||
_vm_filter=$(yq "${_fi%\$} ⟶ $VM_ENTRY\$")
|
_vm_filter=$(yq "${_fi%\$} ⟶ $VM_ENTRY\$")
|
||||||
fi
|
fi
|
||||||
@ -675,13 +775,38 @@ services_fixed_vars() {
|
|||||||
set +f
|
set +f
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# hostlist_payload <files>: zapret-style hostlists (a domain per line, "# comment", ".gz" too)
|
||||||
|
# -> the payload of an inline rule-provider (behavior: domain), deduplicated: "+.a.com"
|
||||||
|
# (with subdomains, as zapret matches), "^b.com" -> "b.com" (zapret: this domain only);
|
||||||
|
# IP lines and junk are dropped; files that are not there are skipped (services_vars warns)
|
||||||
|
hostlist_payload() {
|
||||||
|
set -f
|
||||||
|
for _f in $1; do
|
||||||
|
[ -f "$_f" ] && [ -r "$_f" ] || continue
|
||||||
|
case "$_f" in *.gz) gzip -dc "$_f" 2>/dev/null ;; *) cat "$_f" ;; esac
|
||||||
|
echo
|
||||||
|
done | awk '{
|
||||||
|
sub(/#.*/, ""); gsub(/[ \t\r]/, ""); $0 = tolower($0)
|
||||||
|
exact = sub(/^\^/, "")
|
||||||
|
sub(/^\*/, ""); sub(/^\+/, ""); sub(/^\./, ""); sub(/\.$/, "")
|
||||||
|
if ($0 !~ /^[a-z0-9_-]+(\.[a-z0-9_-]+)*$/ || $0 ~ /^[0-9.]+$/) next
|
||||||
|
d = (exact ? "" : "+.") $0
|
||||||
|
if (!(d in seen)) { seen[d] = 1; print d }
|
||||||
|
}'
|
||||||
|
set +f
|
||||||
|
}
|
||||||
|
|
||||||
# svc_vars <name>: SVC_NAME SVC_GROUP SVC_GEOSITE SVC_DOMAINS SVC_IPS SVC_VIA SVC_PROXIES
|
# svc_vars <name>: SVC_NAME SVC_GROUP SVC_GEOSITE SVC_DOMAINS SVC_IPS SVC_VIA SVC_PROXIES
|
||||||
# for the svc templates; ITEM_TAGS " svc_my " when the service goes through own servers
|
# SVC_HOSTLIST (the payload of hostlist-<name>, hostlist_payload) for the svc templates;
|
||||||
|
# ITEM_TAGS " svc_my " when the service goes through own servers, + " svc_hostlist "
|
||||||
svc_vars() {
|
svc_vars() {
|
||||||
_k=$(svc_key "$1")
|
_k=$(svc_key "$1")
|
||||||
SVC_NAME=$1
|
SVC_NAME=$1
|
||||||
SVC_GROUP=$(printf '%s' "$1" | tr 'a-z' 'A-Z')
|
SVC_GROUP=$(printf '%s' "$1" | tr 'a-z' 'A-Z')
|
||||||
eval "SVC_GEOSITE=\${${_k}_GEOSITE:-} SVC_DOMAINS=\${${_k}_DOMAINS:-} SVC_IPS=\${${_k}_IPS:-} SVC_VIA=\${${_k}_VIA:-MY} SVC_CHAIN=\${${_k}_CHAIN:-}"
|
eval "SVC_GEOSITE=\${${_k}_GEOSITE:-} SVC_DOMAINS=\${${_k}_DOMAINS:-} SVC_IPS=\${${_k}_IPS:-} SVC_VIA=\${${_k}_VIA:-MY} SVC_CHAIN=\${${_k}_CHAIN:-}"
|
||||||
|
eval "SVC_HOSTLIST_FILES=\${${_k}_HOSTLIST:-}"
|
||||||
|
SVC_HOSTLIST=""
|
||||||
|
[ -z "$SVC_HOSTLIST_FILES" ] || SVC_HOSTLIST=$(hostlist_payload "$SVC_HOSTLIST_FILES")
|
||||||
eval "SVC_SERVER=\${${_k}_SERVER:-}"
|
eval "SVC_SERVER=\${${_k}_SERVER:-}"
|
||||||
[ -z "$SVC_SERVER" ] || SVC_VIA="SVC-FIXED-$(printf '%s' "$1" | tr 'a-z' 'A-Z')"
|
[ -z "$SVC_SERVER" ] || SVC_VIA="SVC-FIXED-$(printf '%s' "$1" | tr 'a-z' 'A-Z')"
|
||||||
SVC_DOMAINS=$(norm_list dom "$SVC_DOMAINS")
|
SVC_DOMAINS=$(norm_list dom "$SVC_DOMAINS")
|
||||||
@ -701,7 +826,8 @@ svc_vars() {
|
|||||||
SVC_PROXIES="\"$SVC_VIA\""
|
SVC_PROXIES="\"$SVC_VIA\""
|
||||||
[ -z "$SVC_CHAIN" ] || SVC_PROXIES="\"$SVC_VIA ⟶ $SVC_CHAIN\""
|
[ -z "$SVC_CHAIN" ] || SVC_PROXIES="\"$SVC_VIA ⟶ $SVC_CHAIN\""
|
||||||
fi
|
fi
|
||||||
export SVC_NAME SVC_GROUP SVC_GEOSITE SVC_DOMAINS SVC_IPS SVC_PROXIES
|
[ -z "$SVC_HOSTLIST" ] || ITEM_TAGS="${ITEM_TAGS:- }svc_hostlist "
|
||||||
|
export SVC_NAME SVC_GROUP SVC_GEOSITE SVC_DOMAINS SVC_IPS SVC_PROXIES SVC_HOSTLIST
|
||||||
}
|
}
|
||||||
|
|
||||||
# check SERVICES and their keys; GEOSITE_ITEMS: the geosite lists of all services, once each
|
# check SERVICES and their keys; GEOSITE_ITEMS: the geosite lists of all services, once each
|
||||||
@ -719,7 +845,12 @@ services_vars() {
|
|||||||
*" $SVC_VIA "*) ;;
|
*" $SVC_VIA "*) ;;
|
||||||
*) die "$(svc_key "$_s")_VIA: MY, FOREIGN, RU, DIRECT, MAIN or a pool${POOL_GROUPS% }, not '$SVC_VIA'" ;;
|
*) die "$(svc_key "$_s")_VIA: MY, FOREIGN, RU, DIRECT, MAIN or a pool${POOL_GROUPS% }, not '$SVC_VIA'" ;;
|
||||||
esac
|
esac
|
||||||
[ -n "$SVC_GEOSITE$SVC_DOMAINS$SVC_IPS" ] || die "service $_s: no GEOSITE, DOMAINS or IPS"
|
[ -n "$SVC_GEOSITE$SVC_DOMAINS$SVC_IPS$SVC_HOSTLIST_FILES" ] || die "service $_s: no GEOSITE, DOMAINS, IPS or HOSTLIST"
|
||||||
|
for _f in $SVC_HOSTLIST_FILES; do
|
||||||
|
[ -f "$_f" ] && [ -r "$_f" ] || log "warning: $(svc_key "$_s")_HOSTLIST: no file $_f, skipped"
|
||||||
|
done
|
||||||
|
[ -z "$SVC_HOSTLIST_FILES" ] || [ -n "$SVC_HOSTLIST" ] ||
|
||||||
|
log "warning: $(svc_key "$_s")_HOSTLIST: no domains in $SVC_HOSTLIST_FILES"
|
||||||
if [ -n "$SVC_CHAIN" ]; then
|
if [ -n "$SVC_CHAIN" ]; then
|
||||||
case " MY$POOL_GROUPS" in *" $SVC_VIA "*) ;; *) die "$(svc_key "$_s")_CHAIN: only for _VIA = MY or a pool" ;; esac
|
case " MY$POOL_GROUPS" in *" $SVC_VIA "*) ;; *) die "$(svc_key "$_s")_CHAIN: only for _VIA = MY or a pool" ;; esac
|
||||||
_entries=" DIRECT FOREIGN RU MY${POOL_GROUPS% }"
|
_entries=" DIRECT FOREIGN RU MY${POOL_GROUPS% }"
|
||||||
@ -837,6 +968,11 @@ render_section() {
|
|||||||
done
|
done
|
||||||
IFS=$_old_ifs
|
IFS=$_old_ifs
|
||||||
ITEM_TAGS=""
|
ITEM_TAGS=""
|
||||||
|
elif [ "$EACH" = 1 ] && [ "$_mod" = myvia ]; then
|
||||||
|
for _it in $MYVIA_ITEMS; do
|
||||||
|
myvia_vars "$_it"
|
||||||
|
render_part "$f"
|
||||||
|
done
|
||||||
elif [ "$EACH" = 1 ] && [ "$_mod" = svc ]; then
|
elif [ "$EACH" = 1 ] && [ "$_mod" = svc ]; then
|
||||||
for _it in $SERVICES; do
|
for _it in $SERVICES; do
|
||||||
svc_vars "$_it"
|
svc_vars "$_it"
|
||||||
@ -925,8 +1061,10 @@ render() {
|
|||||||
for _l in RU_IPS FOREIGN_IPS MY_IPS; do eval "$_l=\$(norm_list ip \"\$$_l\")"; done
|
for _l in RU_IPS FOREIGN_IPS MY_IPS; do eval "$_l=\$(norm_list ip \"\$$_l\")"; done
|
||||||
for _l in RU_DOMAINS FOREIGN_DOMAINS MY_DOMAINS; do eval "$_l=\$(norm_list dom \"\$$_l\")"; done
|
for _l in RU_DOMAINS FOREIGN_DOMAINS MY_DOMAINS; do eval "$_l=\$(norm_list dom \"\$$_l\")"; done
|
||||||
# after compute_tags: pools use SUB_LIST / MY_SUB_LIST
|
# after compute_tags: pools use SUB_LIST / MY_SUB_LIST
|
||||||
|
my_node_vars
|
||||||
services_fixed_vars
|
services_fixed_vars
|
||||||
pools_vars
|
pools_vars
|
||||||
|
own_entries_check
|
||||||
services_vars
|
services_vars
|
||||||
[ -n "$GEOSITE_ITEMS" ] && TAGS="$TAGS geosite "
|
[ -n "$GEOSITE_ITEMS" ] && TAGS="$TAGS geosite "
|
||||||
variants_build
|
variants_build
|
||||||
@ -935,7 +1073,7 @@ render() {
|
|||||||
BOOT_PBK BOOT_SID TS_HOSTNAME TS_DOMAINS OVPN_PROVIDER OVPN_GROUP OVPN_SERVER_HOST \
|
BOOT_PBK BOOT_SID TS_HOSTNAME TS_DOMAINS OVPN_PROVIDER OVPN_GROUP OVPN_SERVER_HOST \
|
||||||
OVPN_SERVER_IPS OVPN_ROUTES OVPN_CHECK_URL TS_CHECK_URL CSQTT_IFACE CSQTT_PROCESS \
|
OVPN_SERVER_IPS OVPN_ROUTES OVPN_CHECK_URL TS_CHECK_URL CSQTT_IFACE CSQTT_PROCESS \
|
||||||
RU_IPS FOREIGN_IPS MY_IPS RU_DOMAINS FOREIGN_DOMAINS MY_DOMAINS LOCAL_DOMAINS LOCAL_HOSTS_YAML \
|
RU_IPS FOREIGN_IPS MY_IPS RU_DOMAINS FOREIGN_DOMAINS MY_DOMAINS LOCAL_DOMAINS LOCAL_HOSTS_YAML \
|
||||||
OWN_BODIES OWN_LIST GEOSITE_URL
|
OWN_PLAIN OWN_ENTRY OWN_LIST GEOSITE_URL
|
||||||
_first=1
|
_first=1
|
||||||
for s in head proxies:proxies providers:proxy-providers rule-providers:rule-providers sniffer dns \
|
for s in head proxies:proxies providers:proxy-providers rule-providers:rule-providers sniffer dns \
|
||||||
groups:proxy-groups rules:rules; do
|
groups:proxy-groups rules:rules; do
|
||||||
@ -1220,6 +1358,33 @@ lite_check() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# BYPASS_CLIENTS (common.env): LAN clients by IPv4 (or a subnet) and MAC that nikki leaves
|
||||||
|
# alone, neither their traffic nor their DNS reaches mihomo: e.g. another router with its
|
||||||
|
# own kit behind this one, whose traffic would go through a proxy twice. nikki's own
|
||||||
|
# lan_access_control: a section of the kit's, first among them (the first match wins).
|
||||||
|
BYPASS_SECTION=mihomo_kit_bypass
|
||||||
|
bypass_uci() {
|
||||||
|
_bc=$(sed -n 's/^BYPASS_CLIENTS=//p' "$PROFILES_D/common.env" 2>/dev/null | tail -n 1 | tr -d "'\"")
|
||||||
|
_was=$(uci -q get "nikki.$BYPASS_SECTION.ip" ; uci -q get "nikki.$BYPASS_SECTION.mac")
|
||||||
|
uci -q delete "nikki.$BYPASS_SECTION"
|
||||||
|
if [ -z "$_bc" ]; then
|
||||||
|
[ -z "$_was" ] || log "nikki: no clients bypass mihomo any more"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
uci set "nikki.$BYPASS_SECTION=lan_access_control"
|
||||||
|
uci set "nikki.$BYPASS_SECTION.enabled=1"
|
||||||
|
uci set "nikki.$BYPASS_SECTION.proxy=0"
|
||||||
|
uci set "nikki.$BYPASS_SECTION.dns=0"
|
||||||
|
for _c in $_bc; do
|
||||||
|
case "$_c" in
|
||||||
|
*[:-]*[:-]*[:-]*[:-]*[:-]*) uci add_list "nikki.$BYPASS_SECTION.mac=$(printf '%s' "$_c" | tr 'A-F-' 'a-f:')" ;;
|
||||||
|
*) uci add_list "nikki.$BYPASS_SECTION.ip=$_c" ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
uci reorder "nikki.$BYPASS_SECTION=0"
|
||||||
|
log "nikki: past mihomo: $_bc"
|
||||||
|
}
|
||||||
|
|
||||||
# A new router (no settings yet): interception without TUN, as LITE does (TCP
|
# A new router (no settings yet): interception without TUN, as LITE does (TCP
|
||||||
# redirect, UDP tproxy), and no IPv6 anywhere in nikki. Once the settings are
|
# redirect, UDP tproxy), and no IPv6 anywhere in nikki. Once the settings are
|
||||||
# saved, nikki's own settings are left to the user.
|
# saved, nikki's own settings are left to the user.
|
||||||
@ -1243,6 +1408,7 @@ cmd_use() {
|
|||||||
lite_uci "$1"
|
lite_uci "$1"
|
||||||
csqtt_match_process "$1"
|
csqtt_match_process "$1"
|
||||||
ipv6_proxy_off
|
ipv6_proxy_off
|
||||||
|
bypass_uci
|
||||||
uci commit nikki
|
uci commit nikki
|
||||||
mem_env "$1"
|
mem_env "$1"
|
||||||
/etc/init.d/nikki restart
|
/etc/init.d/nikki restart
|
||||||
@ -1768,9 +1934,18 @@ install_luci() {
|
|||||||
rm -rf /tmp/luci-indexcache* /tmp/luci-modulecache
|
rm -rf /tmp/luci-indexcache* /tmp/luci-modulecache
|
||||||
log "LuCI page installed: Services -> mihomo-kit"
|
log "LuCI page installed: Services -> mihomo-kit"
|
||||||
[ "$_rpcd" = 1 ] || return 0
|
[ "$_rpcd" = 1 ] || return 0
|
||||||
# rpcd loads plugins only on start; delayed so a job started from LuCI
|
# rpcd loads plugins and ACLs only on start. Not "rpcd restart": run from a job LuCI
|
||||||
# (kit update) gets to finish first
|
# started (kit update) this shell is rpcd's descendant, and the stop can take it down
|
||||||
(sleep 5; /etc/init.d/rpcd restart) < /dev/null > /dev/null 2>&1 &
|
# before the start - rpcd stays dead, LuCI says "Object not found" and rejects the
|
||||||
|
# password until a reboot. SIGHUP (through procd: to rpcd itself, not its plugins)
|
||||||
|
# makes rpcd re-exec in place and keep the LuCI sessions; then make sure it runs.
|
||||||
|
# Delayed so the job gets to finish first.
|
||||||
|
(
|
||||||
|
sleep 5
|
||||||
|
ubus call service signal '{"name":"rpcd","signal":1}' || kill -HUP "$(pidof rpcd | cut -d' ' -f1)"
|
||||||
|
sleep 5
|
||||||
|
pidof rpcd || /etc/init.d/rpcd start
|
||||||
|
) < /dev/null > /dev/null 2>&1 &
|
||||||
}
|
}
|
||||||
|
|
||||||
enable_otp_cron() {
|
enable_otp_cron() {
|
||||||
@ -1789,37 +1964,130 @@ enable_otp_cron() {
|
|||||||
opkg_fit() {
|
opkg_fit() {
|
||||||
_new=$(opkg --noaction --force-space install "$@" 2>/dev/null | sed -n 's/^Installing \([^ ]*\) (.*/\1/p')
|
_new=$(opkg --noaction --force-space install "$@" 2>/dev/null | sed -n 's/^Installing \([^ ]*\) (.*/\1/p')
|
||||||
if [ -z "$_new" ]; then
|
if [ -z "$_new" ]; then
|
||||||
opkg install "$@"
|
opkg_q install "$@"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
_field=Installed-Size
|
_field=Installed-Size
|
||||||
case "$(awk '$2 == "/overlay" {print $3; exit}' /proc/mounts)" in ubifs | jffs2) _field=Size ;; esac
|
case "$(awk '$2 == "/overlay" {print $3; exit}' /proc/mounts)" in ubifs | jffs2) _field=Size ;; esac
|
||||||
_need=0
|
|
||||||
for _p in $_new; do
|
|
||||||
_b=$(opkg info "$_p" | sed -n "s/^$_field: *//p" | head -n 1)
|
|
||||||
case "$_b" in '' | *[!0-9]*) _b=0 ;; esac
|
|
||||||
_need=$((_need + (_b + 1023) / 1024))
|
|
||||||
done
|
|
||||||
_free=$(df -k / 2>/dev/null | awk 'NR==2 {print $4}')
|
|
||||||
_new=$(echo $_new)
|
_new=$(echo $_new)
|
||||||
|
# the sizes straight from the feeds' lists, one pass (not "opkg info" per package:
|
||||||
|
# it parses every list each time); a package listed by several feeds counts once
|
||||||
|
_need=$(opkg_lists | awk -v want=" $_new " -v f="$_field:" '
|
||||||
|
$1 == "Package:" { p = $2 }
|
||||||
|
$1 == f && index(want, " " p " ") && !(p in seen) { seen[p] = 1; s += int(($2 + 1023) / 1024) }
|
||||||
|
END { print s + 0 }')
|
||||||
|
_free=$(df -k / 2>/dev/null | awk 'NR==2 {print $4}')
|
||||||
log "packages $_new: about $_need KB on flash ($_field), free ${_free:-?} KB"
|
log "packages $_new: about $_need KB on flash ($_field), free ${_free:-?} KB"
|
||||||
[ $((${_free:-0} - _need)) -ge "$PKG_RESERVE_KB" ] ||
|
[ $((${_free:-0} - _need)) -ge "$PKG_RESERVE_KB" ] ||
|
||||||
die "not enough flash for $_new: free $((PKG_RESERVE_KB + _need - ${_free:-0})) KB more"
|
die "not enough flash for $_new: free $((PKG_RESERVE_KB + _need - ${_free:-0})) KB more"
|
||||||
opkg install --force-space "$@"
|
opkg_q install --force-space "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
# opkg_lists: the package lists of all feeds as text (opkg keeps them gzipped in lists_dir)
|
||||||
|
opkg_lists() {
|
||||||
|
_ld=$(awk '$1 == "lists_dir" { print $3; exit }' /etc/opkg.conf 2>/dev/null)
|
||||||
|
for _lf in "${_ld:-/var/opkg-lists}"/*; do
|
||||||
|
case "$_lf" in *.sig) continue ;; esac
|
||||||
|
[ -f "$_lf" ] || continue
|
||||||
|
gunzip -c "$_lf" 2>/dev/null || cat "$_lf"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# opkg_q <args>: opkg without its "ERROR: truncating field N <0x...> to M byte" noise. opkg-lede
|
||||||
|
# prints it (without a newline, once per field) when several feeds list the same package -
|
||||||
|
# e.g. firmwares with nikki in their own feeds (Routerich) plus the kit's - and it is harmless.
|
||||||
|
# The exit code is opkg's.
|
||||||
|
opkg_q() {
|
||||||
|
_qrc=/tmp/mihomo-kit-opkg.rc.$$
|
||||||
|
{ opkg "$@" 2>&1; echo "$?" > "$_qrc"; } |
|
||||||
|
sed 's/ERROR: truncating field [0-9]* <0x[0-9a-fA-F]*> to [0-9]* byte//g' | grep -v '^[[:space:]]*$'
|
||||||
|
_rc=$(cat "$_qrc" 2>/dev/null || echo 1)
|
||||||
|
rm -f "$_qrc"
|
||||||
|
return "$_rc"
|
||||||
|
}
|
||||||
|
|
||||||
|
# --- nikki from its release bundle ------------------------------------------
|
||||||
|
# A release of OpenWrt-nikki has one nikki_<arch>-<branch>.tar.gz per router type, and
|
||||||
|
# each is a whole opkg feed: Packages(.gz) signed with nikki's key + the .ipk files.
|
||||||
|
# nikki_feed unpacks the one for this router into RAM and adds it as a temporary feed,
|
||||||
|
# so opkg checks the signature (key from the kit: router/nikki-key-build.pub), takes
|
||||||
|
# the dependencies from the OpenWrt feeds and opkg_fit counts the flash as usual.
|
||||||
|
# The bundle comes from NIKKI_BASES (the kit's mirror first, then GitHub), or from
|
||||||
|
# the file NIKKI_TGZ copied to the router by hand.
|
||||||
|
NIKKI_FEED=/tmp/nikki-feed
|
||||||
|
NIKKI_FEED_CONF=/etc/opkg/nikki-kit.conf
|
||||||
|
|
||||||
|
# nikki_bundle: the bundle name for this router (after . /etc/openwrt_release)
|
||||||
|
nikki_bundle() {
|
||||||
|
case "${DISTRIB_RELEASE:-}" in
|
||||||
|
*24.10*) echo "nikki_${DISTRIB_ARCH:-?}-openwrt-24.10.tar.gz" ;;
|
||||||
|
*) return 1 ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
nikki_feed_drop() {
|
||||||
|
rm -rf "$NIKKI_FEED" "$NIKKI_FEED_CONF" /var/opkg-lists/nikki_kit
|
||||||
|
}
|
||||||
|
|
||||||
|
nikki_feed() {
|
||||||
|
[ -f /etc/openwrt_release ] && . /etc/openwrt_release
|
||||||
|
_bundle=$(nikki_bundle) ||
|
||||||
|
die "nikki: OpenWrt ${DISTRIB_RELEASE:-?} не поддерживается (нужна 24.10 с opkg)"
|
||||||
|
nikki_feed_drop
|
||||||
|
mkdir -p "$NIKKI_FEED"
|
||||||
|
if [ -n "${NIKKI_TGZ:-}" ]; then
|
||||||
|
log "nikki: unpacking $NIKKI_TGZ"
|
||||||
|
tar xzf "$NIKKI_TGZ" -C "$NIKKI_FEED" || die "nikki: $NIKKI_TGZ is not a nikki bundle"
|
||||||
|
else
|
||||||
|
for _b in $NIKKI_BASES; do
|
||||||
|
log "nikki: downloading $_b/$_bundle"
|
||||||
|
wget -T 30 -qO- "$_b/$_bundle" | tar xzf - -C "$NIKKI_FEED" 2>/dev/null &&
|
||||||
|
[ -f "$NIKKI_FEED/Packages.gz" ] && break
|
||||||
|
log "nikki: not available there"
|
||||||
|
rm -rf "$NIKKI_FEED"
|
||||||
|
mkdir -p "$NIKKI_FEED"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
if [ ! -f "$NIKKI_FEED/Packages.gz" ]; then
|
||||||
|
nikki_feed_drop
|
||||||
|
die "nikki не скачался ($_bundle). На компьютере скачай его из
|
||||||
|
${NIKKI_BASES%% *}/$_bundle
|
||||||
|
(или https://github.com/nikkinikki-org/OpenWrt-nikki/releases/tag/$NIKKI_VERSION),
|
||||||
|
скопируй на роутер: scp -O $_bundle root@<роутер>:/tmp/
|
||||||
|
и запусти установку снова с NIKKI_TGZ=/tmp/$_bundle перед sh, например:
|
||||||
|
NIKKI_TGZ=/tmp/$_bundle sh /etc/nikki/kit/install.sh"
|
||||||
|
fi
|
||||||
|
# not needed by the kit, only takes RAM (upstream bundles have them)
|
||||||
|
rm -f "$NIKKI_FEED"/mihomo-alpha_*.ipk "$NIKKI_FEED"/luci-i18n-nikki-zh-*.ipk
|
||||||
|
opkg-key add "$KIT_DIR/router/nikki-key-build.pub" >/dev/null 2>&1 ||
|
||||||
|
log "warning: nikki: key not added, opkg may reject the feed signature"
|
||||||
|
echo "src/gz nikki_kit file://$NIKKI_FEED" > "$NIKKI_FEED_CONF"
|
||||||
|
# the feed points into RAM: never leave it behind, also after die
|
||||||
|
trap nikki_feed_drop EXIT
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd_install() {
|
cmd_install() {
|
||||||
opkg update
|
command -v opkg >/dev/null 2>&1 || die "нет opkg: OpenWrt 25.12+ (apk) kit пока не поддерживает"
|
||||||
|
_nikki_new=
|
||||||
if [ ! -x /etc/init.d/nikki ]; then
|
if [ ! -x /etc/init.d/nikki ]; then
|
||||||
# feed.sh saves the feed key to the current directory
|
nikki_feed
|
||||||
(cd /tmp && wget -O - https://github.com/nikkinikki-org/OpenWrt-nikki/raw/refs/heads/main/feed.sh | ash)
|
_nikki_new=1
|
||||||
opkg_fit nikki luci-app-nikki
|
fi
|
||||||
|
opkg update
|
||||||
|
if [ -n "$_nikki_new" ]; then
|
||||||
|
# mihomo-meta named: nikki needs a "mihomo", and the feed also lists mihomo-alpha
|
||||||
|
_luci=
|
||||||
|
[ -d /www/luci-static/resources ] && _luci="luci-app-nikki luci-i18n-nikki-ru"
|
||||||
|
opkg_fit mihomo-meta nikki $_luci
|
||||||
|
nikki_feed_drop
|
||||||
|
trap - EXIT
|
||||||
|
[ -x /etc/init.d/nikki ] || die "nikki не установился, ошибки opkg выше"
|
||||||
fi
|
fi
|
||||||
for p in curl oath-toolkit; do
|
for p in curl oath-toolkit; do
|
||||||
opkg list-installed | grep -q "^$p " || opkg_fit "$p"
|
opkg list-installed | grep -q "^$p " || opkg_fit "$p"
|
||||||
done
|
done
|
||||||
# curl newer than libcurl -> "Error relocating ... symbol not found"
|
# curl newer than libcurl -> "Error relocating ... symbol not found"
|
||||||
curl --version >/dev/null 2>&1 || opkg install --force-reinstall libcurl4 curl
|
curl --version >/dev/null 2>&1 || opkg_q install --force-reinstall libcurl4 curl
|
||||||
nikki_defaults
|
nikki_defaults
|
||||||
install_files
|
install_files
|
||||||
cmd_fix
|
cmd_fix
|
||||||
@ -1879,7 +2147,7 @@ cmd_pkg_install() {
|
|||||||
die "not enough flash, nothing installed (free $((PKG_RESERVE_KB - _left)) KB more)"
|
die "not enough flash, nothing installed (free $((PKG_RESERVE_KB - _left)) KB more)"
|
||||||
/etc/init.d/nikki stop 2>/dev/null
|
/etc/init.d/nikki stop 2>/dev/null
|
||||||
_rc=0
|
_rc=0
|
||||||
opkg install --force-space "$@" || _rc=$?
|
opkg_q install --force-space "$@" || _rc=$?
|
||||||
# a nikki upgrade replaces /etc/init.d/nikki (the kit's lines are gone): fix puts
|
# a nikki upgrade replaces /etc/init.d/nikki (the kit's lines are gone): fix puts
|
||||||
# them back, checks the core and starts nikki - also after a failed install
|
# them back, checks the core and starts nikki - also after a failed install
|
||||||
cmd_fix
|
cmd_fix
|
||||||
@ -2062,7 +2330,7 @@ common_other_keys() {
|
|||||||
write_config() {
|
write_config() {
|
||||||
umask 077
|
umask 077
|
||||||
_any_hwid=0
|
_any_hwid=0
|
||||||
[ "${FORM:-0}" = 1 ] && COMMON_KEYS="$COMMON_KEYS|HY2|HY2_[A-Z0-9_]+|MY_IPS|MY_DOMAINS|LOCAL_HOSTS|MY_LINKS|LITE|LITE_GOMEMLIMIT|OVPN_CHECK_URL|TS_CHECK_URL|MOBILE|SERVICES|SVC_[A-Z0-9_]+|POOLS|POOL_[A-Z0-9_]+"
|
[ "${FORM:-0}" = 1 ] && COMMON_KEYS="$COMMON_KEYS|HY2|HY2_[A-Z0-9_]+|MY_IPS|MY_DOMAINS|LOCAL_HOSTS|MY_LINKS|LITE|LITE_GOMEMLIMIT|OVPN_CHECK_URL|TS_CHECK_URL|MOBILE|BYPASS_CLIENTS|MY_NODE_[0-9]+|SERVICES|SVC_[A-Z0-9_]+|POOLS|POOL_[A-Z0-9_]+"
|
||||||
_others=$(common_other_keys)
|
_others=$(common_other_keys)
|
||||||
sub_pairs
|
sub_pairs
|
||||||
{
|
{
|
||||||
@ -2107,7 +2375,11 @@ write_config() {
|
|||||||
[ -n "${MY_IPS:-}" ] && echo "MY_IPS=$(q "$MY_IPS")"
|
[ -n "${MY_IPS:-}" ] && echo "MY_IPS=$(q "$MY_IPS")"
|
||||||
[ -n "${MY_DOMAINS:-}" ] && echo "MY_DOMAINS=$(q "$MY_DOMAINS")"
|
[ -n "${MY_DOMAINS:-}" ] && echo "MY_DOMAINS=$(q "$MY_DOMAINS")"
|
||||||
[ -n "${LOCAL_HOSTS:-}" ] && echo "LOCAL_HOSTS=$(q "$LOCAL_HOSTS")"
|
[ -n "${LOCAL_HOSTS:-}" ] && echo "LOCAL_HOSTS=$(q "$LOCAL_HOSTS")"
|
||||||
|
[ -n "${BYPASS_CLIENTS:-}" ] && echo "BYPASS_CLIENTS=$(q "$BYPASS_CLIENTS")"
|
||||||
[ -n "${MY_LINKS:-}" ] && echo "MY_LINKS=$(q "$MY_LINKS")"
|
[ -n "${MY_LINKS:-}" ] && echo "MY_LINKS=$(q "$MY_LINKS")"
|
||||||
|
printf '%s\n' "${MY_NODE_ENTRIES:-}" | grep . | awk '{ print NR "\t" $0 }' | while IFS=' ' read -r _mk _ml; do
|
||||||
|
echo "MY_NODE_$_mk=$(q "$_ml")"
|
||||||
|
done
|
||||||
[ -n "${POOLS:-}" ] && echo "POOLS=$(q "$POOLS")"
|
[ -n "${POOLS:-}" ] && echo "POOLS=$(q "$POOLS")"
|
||||||
for _s in ${POOLS:-}; do
|
for _s in ${POOLS:-}; do
|
||||||
_k=$(pool_key "$_s")
|
_k=$(pool_key "$_s")
|
||||||
@ -2176,8 +2448,10 @@ cmd_configure() {
|
|||||||
[ -f "${1:-}" ] || die "usage: configure <env>"
|
[ -f "${1:-}" ] || die "usage: configure <env>"
|
||||||
# saved OpenVPN secrets stay unless the form sends new ones
|
# saved OpenVPN secrets stay unless the form sends new ones
|
||||||
[ -f "$NIKKI_DIR/openvpn.env" ] && . "$NIKKI_DIR/openvpn.env"
|
[ -f "$NIKKI_DIR/openvpn.env" ] && . "$NIKKI_DIR/openvpn.env"
|
||||||
# the saved networks unless the form sends them
|
# the saved networks, [MY] node entries and clients past mihomo unless the form sends them
|
||||||
|
BYPASS_CLIENTS=$(sed -n "s/^BYPASS_CLIENTS=//p" "$PROFILES_D/common.env" 2>/dev/null | tail -n 1 | tr -d "'\"")
|
||||||
OVPN_ROUTES=$(sed -n "s/^OVPN_ROUTES=//p" "$PROFILES_D/common.env" 2>/dev/null | tail -n 1 | tr -d "'\"")
|
OVPN_ROUTES=$(sed -n "s/^OVPN_ROUTES=//p" "$PROFILES_D/common.env" 2>/dev/null | tail -n 1 | tr -d "'\"")
|
||||||
|
MY_NODE_ENTRIES=$( (. "$PROFILES_D/common.env" 2>/dev/null; my_nodes_join) )
|
||||||
. "$1"
|
. "$1"
|
||||||
rm -f "$1"
|
rm -f "$1"
|
||||||
BOOT=0 BOOT_LINKS=${BOOT_LINKS:-}
|
BOOT=0 BOOT_LINKS=${BOOT_LINKS:-}
|
||||||
@ -2286,14 +2560,14 @@ cmd_import() {
|
|||||||
case "${_f#profiles.d/}" in */* | *[!A-Za-z0-9_.-]*) die "bad file name: $_f" ;; esac
|
case "${_f#profiles.d/}" in */* | *[!A-Za-z0-9_.-]*) die "bad file name: $_f" ;; esac
|
||||||
done
|
done
|
||||||
# _drop: keys of the bundle replaced by this router's ones (LOCAL_HOSTS always)
|
# _drop: keys of the bundle replaced by this router's ones (LOCAL_HOSTS always)
|
||||||
_keep="" _drop=LOCAL_HOSTS
|
_keep="" _drop="LOCAL_HOSTS|BYPASS_CLIENTS"
|
||||||
if [ "${2:-}" = --keep-local ]; then
|
if [ "${2:-}" = --keep-local ]; then
|
||||||
for _k in TS_HOSTNAME HWID_ID LOCAL_HOSTS; do
|
for _k in TS_HOSTNAME HWID_ID LOCAL_HOSTS BYPASS_CLIENTS; do
|
||||||
_l=$(grep "^$_k=" "$PROFILES_D/common.env" 2>/dev/null | tail -n 1)
|
_l=$(grep "^$_k=" "$PROFILES_D/common.env" 2>/dev/null | tail -n 1)
|
||||||
[ -n "$_l" ] || continue
|
[ -n "$_l" ] || continue
|
||||||
_keep="$_keep$_l
|
_keep="$_keep$_l
|
||||||
"
|
"
|
||||||
[ "$_k" = LOCAL_HOSTS ] || _drop="$_drop|$_k"
|
case "$_k" in LOCAL_HOSTS | BYPASS_CLIENTS) ;; *) _drop="$_drop|$_k" ;; esac
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
_tmp=$(mktemp -d)
|
_tmp=$(mktemp -d)
|
||||||
|
|||||||
3
router/nikki-key-build.pub
Normal file
3
router/nikki-key-build.pub
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
untrusted comment: Nikki
|
||||||
|
RWSrAXyIqregizvXvG9kJI/JoTkaCCPDy6CQrrVQ4IZ8Qgu+iWMql0UW
|
||||||
|
|
||||||
@ -77,6 +77,10 @@ RU_IPS="194.190.191.112/32"
|
|||||||
#POOL_DE_EXCLUDE='(?i)torrent'
|
#POOL_DE_EXCLUDE='(?i)torrent'
|
||||||
#POOL_DE_UPLINK=1 # offer in UPLINK: everything through the pool first
|
#POOL_DE_UPLINK=1 # offer in UPLINK: everything through the pool first
|
||||||
|
|
||||||
|
# [MY] nodes of the subscriptions with an entry of their own (LuCI: «Свои серверы» →
|
||||||
|
# «Из подписок ([MY])»): "<ENTRY>|<id>-my|<exact node name>", ENTRY FOREIGN, RU, DIRECT or a pool
|
||||||
|
#MY_NODE_1='FOREIGN|sam_hub-my|[MY] 🇩🇪 de-1'
|
||||||
|
|
||||||
# OpenVPN by /etc/nikki/openvpn.ovpn, login in /etc/nikki/openvpn.env (ovpn.sh)
|
# OpenVPN by /etc/nikki/openvpn.ovpn, login in /etc/nikki/openvpn.env (ovpn.sh)
|
||||||
OPENVPN=0
|
OPENVPN=0
|
||||||
#OVPN_ROUTES="10.0.0.0/8 192.168.50.0/24" # what goes through the VPN (LuCI: the .ovpn's route lines)
|
#OVPN_ROUTES="10.0.0.0/8 192.168.50.0/24" # what goes through the VPN (LuCI: the .ovpn's route lines)
|
||||||
|
|||||||
@ -3,7 +3,8 @@
|
|||||||
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
||||||
# main provider saves (mihomo watches it; ./providers exists before the start,
|
# main provider saves (mihomo watches it; ./providers exists before the start,
|
||||||
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
||||||
# so the subscription is fetched once more.
|
# so the subscription is fetched once more. Nodes with an entry of their own
|
||||||
|
# (MY_NODE_ENTRIES) are left out here for <id>-my-via-<entry> (providers/16-myvia).
|
||||||
${SUB_NAME}-my:
|
${SUB_NAME}-my:
|
||||||
type: file #@router
|
type: file #@router
|
||||||
path: ./providers/${SUB_NAME}.yaml #@router
|
path: ./providers/${SUB_NAME}.yaml #@router
|
||||||
@ -13,6 +14,7 @@
|
|||||||
interval: 3600 #@mobile
|
interval: 3600 #@mobile
|
||||||
proxy: ${@SUB_PROXY} #@mobile
|
proxy: ${@SUB_PROXY} #@mobile
|
||||||
filter: "(?i)\\[MY\\]"
|
filter: "(?i)\\[MY\\]"
|
||||||
|
exclude-filter: "${@@SUB_MY_EXCLUDE}"
|
||||||
override: #@my_exit
|
override: #@my_exit
|
||||||
dialer-proxy: MY-EXIT #@my_exit
|
dialer-proxy: MY-EXIT #@my_exit
|
||||||
override: #@uplink,!my_exit
|
override: #@uplink,!my_exit
|
||||||
|
|||||||
24
templates/providers/16-myvia.each.yaml
Normal file
24
templates/providers/16-myvia.each.yaml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# [MY] nodes of ${SUB_NAME} with an entry of their own (LuCI «Свои серверы» → «Вход»):
|
||||||
|
# out of ${SUB_NAME}-my, dialing through ${MV_ENTRY} in every profile
|
||||||
|
${MV_NAME}:
|
||||||
|
type: file #@router
|
||||||
|
path: ./providers/${SUB_NAME}.yaml #@router
|
||||||
|
type: http #@mobile
|
||||||
|
url: "${SUB_URL}" #@mobile
|
||||||
|
path: ./providers/${MV_NAME}.yaml #@mobile
|
||||||
|
interval: 3600 #@mobile
|
||||||
|
proxy: ${@SUB_PROXY} #@mobile
|
||||||
|
filter: "${MV_FILTER}"
|
||||||
|
override:
|
||||||
|
dialer-proxy: ${MV_ENTRY}
|
||||||
|
header: #@mobile
|
||||||
|
User-Agent: ["${SUB_UA}"] #@mobile
|
||||||
|
${@@SUB_HEADERS} #@mobile
|
||||||
|
health-check:
|
||||||
|
enable: true
|
||||||
|
url: "https://www.gstatic.com/generate_204"
|
||||||
|
interval: 300 #@!lite
|
||||||
|
interval: 600 #@lite
|
||||||
|
timeout: 3000
|
||||||
|
lazy: false #@!lite
|
||||||
|
lazy: true #@lite
|
||||||
@ -1,6 +1,8 @@
|
|||||||
# own servers of the settings (LuCI "Свои серверы", /etc/nikki/my-servers): one JSON
|
# own servers of the settings (LuCI "Свои серверы", /etc/nikki/my-servers): one JSON
|
||||||
# proxy per line, as mihomo's own config would have it; the kit puts dialer-proxy in
|
# proxy per line, as mihomo's own config would have it; the kit puts dialer-proxy in
|
||||||
# front: whitelist and the phone through MY-EXIT, else with UPLINK (CSQTT, pools) through it
|
# front: whitelist and the phone through MY-EXIT, else with UPLINK (CSQTT, pools) through it.
|
||||||
- {"dialer-proxy": "MY-EXIT", ${@@OWN_BODIES} #@my_exit
|
# A server with an entry of its own (LuCI "Вход") keeps it in every profile
|
||||||
- {"dialer-proxy": "UPLINK", ${@@OWN_BODIES} #@uplink,!my_exit
|
- {"dialer-proxy": "MY-EXIT", ${@@OWN_PLAIN} #@my_exit
|
||||||
- {${@@OWN_BODIES} #@!my_exit,!uplink
|
- {"dialer-proxy": "UPLINK", ${@@OWN_PLAIN} #@uplink,!my_exit
|
||||||
|
- {${@@OWN_PLAIN} #@!my_exit,!uplink
|
||||||
|
${@@OWN_ENTRY}
|
||||||
|
|||||||
7
templates/rule-providers/35-svc.each.yaml
Normal file
7
templates/rule-providers/35-svc.each.yaml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# service ${SVC_NAME}: domains of its hostlists (SVC_<NAME>_HOSTLIST, e.g. zapret's #@svc_hostlist
|
||||||
|
# /opt/zapret2/ipset/*.txt), read when the profile is built: rebuild to pick up changes #@svc_hostlist
|
||||||
|
hostlist-${SVC_NAME}: #@svc_hostlist
|
||||||
|
type: inline #@svc_hostlist
|
||||||
|
behavior: domain #@svc_hostlist
|
||||||
|
payload: #@svc_hostlist
|
||||||
|
- "${@SVC_HOSTLIST}" #@svc_hostlist
|
||||||
@ -2,3 +2,4 @@
|
|||||||
- RULE-SET,geosite-${@SVC_GEOSITE},${SVC_GROUP}
|
- RULE-SET,geosite-${@SVC_GEOSITE},${SVC_GROUP}
|
||||||
- DOMAIN-SUFFIX,${@SVC_DOMAINS},${SVC_GROUP}
|
- DOMAIN-SUFFIX,${@SVC_DOMAINS},${SVC_GROUP}
|
||||||
- IP-CIDR,${@SVC_IPS},${SVC_GROUP}
|
- IP-CIDR,${@SVC_IPS},${SVC_GROUP}
|
||||||
|
- RULE-SET,hostlist-${SVC_NAME},${SVC_GROUP} #@svc_hostlist
|
||||||
|
|||||||
@ -16,12 +16,14 @@ proxies:
|
|||||||
|
|
||||||
# own servers of the settings (LuCI "Свои серверы", /etc/nikki/my-servers): one JSON
|
# own servers of the settings (LuCI "Свои серверы", /etc/nikki/my-servers): one JSON
|
||||||
# proxy per line, as mihomo's own config would have it; the kit puts dialer-proxy in
|
# proxy per line, as mihomo's own config would have it; the kit puts dialer-proxy in
|
||||||
# front: whitelist and the phone through MY-EXIT, else with UPLINK (CSQTT, pools) through it
|
# front: whitelist and the phone through MY-EXIT, else with UPLINK (CSQTT, pools) through it.
|
||||||
|
# A server with an entry of its own (LuCI "Вход") keeps it in every profile
|
||||||
- {"dialer-proxy": "MY-EXIT", "name":"🇩🇪 de 1","type":"vless","server":"x.example.com","port":"443","uuid":"00000000-0000-0000-0000-000000000001","udp":true,"tls":true,"client-fingerprint":"chrome","servername":"www.example.com","reality-opts":{"public-key":"Nc9ZSDuQMwHN4M6TeDHjfJhgZ6SBTBbfMwx5iHQZ1ns","short-id":"ab"},"xudp":true,"network":"xhttp","xhttp-opts":{"path":"/x"}}
|
- {"dialer-proxy": "MY-EXIT", "name":"🇩🇪 de 1","type":"vless","server":"x.example.com","port":"443","uuid":"00000000-0000-0000-0000-000000000001","udp":true,"tls":true,"client-fingerprint":"chrome","servername":"www.example.com","reality-opts":{"public-key":"Nc9ZSDuQMwHN4M6TeDHjfJhgZ6SBTBbfMwx5iHQZ1ns","short-id":"ab"},"xudp":true,"network":"xhttp","xhttp-opts":{"path":"/x"}}
|
||||||
- {"dialer-proxy": "MY-EXIT", "name":"tr \"q\"","type":"trojan","server":"t.example.org","port":"443","password":"p\u0024w","udp":true,"skip-cert-verify":false,"sni":"t.example.org","network":"grpc","grpc-opts":{"grpc-service-name":"g"},"client-fingerprint":"chrome"}
|
- {"dialer-proxy": "MY-EXIT", "name":"tr \"q\"","type":"trojan","server":"t.example.org","port":"443","password":"p\u0024w","udp":true,"skip-cert-verify":false,"sni":"t.example.org","network":"grpc","grpc-opts":{"grpc-service-name":"g"},"client-fingerprint":"chrome"}
|
||||||
- {"dialer-proxy": "MY-EXIT", "name":"hy-own","type":"hysteria2","server":"h.example.net","port":8443,"password":"a\u0024b","obfs":"salamander","obfs-password":"o","up":"50 mbps"}
|
- {"dialer-proxy": "MY-EXIT", "name":"hy-own","type":"hysteria2","server":"h.example.net","port":8443,"password":"a\u0024b","obfs":"salamander","obfs-password":"o","up":"50 mbps"}
|
||||||
- {"dialer-proxy": "MY-EXIT", "name":"awg-own","type":"wireguard","server":"203.0.113.10","port":47613,"ip":"10.8.1.2","private-key":"fTo2df+b5vCuulh7pOXMWiWJY2VwSe2Kuup2nA34tfI=","public-key":"vGYpG72gCXPNfYzr/0iNfSoL83vbrVSGUC+v+MKRVyE=","pre-shared-key":"6ut/J6EuaJ97RMFcZuiJkzIo7a5uxR98htK5NdWJW6E=","persistent-keepalive":25,"udp":true,"amnezia-wg-option":{"jc":4,"jmin":10,"jmax":50,"s1":98,"s2":32,"s3":19,"s4":7,"h1":"1458367412-1593426716","h2":"1863071624-1902347825","h3":"2091548318-2097143921","h4":"2112573893-2147191025","i1":"<r 2><b 0x858000010001000000000669636c6f756403636f6d0000010001c00c000100010000105a00044d583737>"}}
|
- {"dialer-proxy": "MY-EXIT", "name":"awg-own","type":"wireguard","server":"203.0.113.10","port":47613,"ip":"10.8.1.2","private-key":"fTo2df+b5vCuulh7pOXMWiWJY2VwSe2Kuup2nA34tfI=","public-key":"vGYpG72gCXPNfYzr/0iNfSoL83vbrVSGUC+v+MKRVyE=","pre-shared-key":"6ut/J6EuaJ97RMFcZuiJkzIo7a5uxR98htK5NdWJW6E=","persistent-keepalive":25,"udp":true,"amnezia-wg-option":{"jc":4,"jmin":10,"jmax":50,"s1":98,"s2":32,"s3":19,"s4":7,"h1":"1458367412-1593426716","h2":"1863071624-1902347825","h3":"2091548318-2097143921","h4":"2112573893-2147191025","i1":"<r 2><b 0x858000010001000000000669636c6f756403636f6d0000010001c00c000100010000105a00044d583737>"}}
|
||||||
- {"dialer-proxy": "MY-EXIT", "name":"m1","type":"hysteria2","server":"m.example.com","port":443,"password":"p","udp":true}
|
- {"dialer-proxy": "MY-EXIT", "name":"m1","type":"hysteria2","server":"m.example.com","port":443,"password":"p","udp":true}
|
||||||
|
- {"name":"via-foreign","type":"ss","server":"f.example.com","port":8388,"cipher":"aes-256-gcm","password":"x","dialer-proxy":"FOREIGN"}
|
||||||
|
|
||||||
# copies of own servers for the chains (SVC_<NAME>_CHAIN, POOL_<NAME>_UPLINK): the same
|
# copies of own servers for the chains (SVC_<NAME>_CHAIN, POOL_<NAME>_UPLINK): the same
|
||||||
# server dialing through another entry, named "<server> ⟶ <entry>" (group "<pool> ⟶ <entry>")
|
# server dialing through another entry, named "<server> ⟶ <entry>" (group "<pool> ⟶ <entry>")
|
||||||
@ -71,7 +73,8 @@ proxy-providers:
|
|||||||
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
||||||
# main provider saves (mihomo watches it; ./providers exists before the start,
|
# main provider saves (mihomo watches it; ./providers exists before the start,
|
||||||
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
||||||
# so the subscription is fetched once more.
|
# so the subscription is fetched once more. Nodes with an entry of their own
|
||||||
|
# (MY_NODE_ENTRIES) are left out here for <id>-my-via-<entry> (providers/16-myvia).
|
||||||
example-my:
|
example-my:
|
||||||
type: http
|
type: http
|
||||||
url: "https://sub.example.com/sub/aaa"
|
url: "https://sub.example.com/sub/aaa"
|
||||||
@ -95,7 +98,8 @@ proxy-providers:
|
|||||||
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
||||||
# main provider saves (mihomo watches it; ./providers exists before the start,
|
# main provider saves (mihomo watches it; ./providers exists before the start,
|
||||||
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
||||||
# so the subscription is fetched once more.
|
# so the subscription is fetched once more. Nodes with an entry of their own
|
||||||
|
# (MY_NODE_ENTRIES) are left out here for <id>-my-via-<entry> (providers/16-myvia).
|
||||||
example2-my:
|
example2-my:
|
||||||
type: http
|
type: http
|
||||||
url: "https://sub2.example.com/x?a=1&b=2"
|
url: "https://sub2.example.com/x?a=1&b=2"
|
||||||
@ -260,7 +264,7 @@ proxy-groups:
|
|||||||
# the subscriptions (providers <id>-my); the fastest alive one; pin one in the dashboard if needed
|
# the subscriptions (providers <id>-my); the fastest alive one; pin one in the dashboard if needed
|
||||||
- name: MY
|
- name: MY
|
||||||
type: url-test
|
type: url-test
|
||||||
proxies: ["🇩🇪 de 1", "tr \"q\"", "hy-own", "awg-own", "m1"]
|
proxies: ["🇩🇪 de 1", "tr \"q\"", "hy-own", "awg-own", "via-foreign", "m1"]
|
||||||
use: [example-my, example2-my]
|
use: [example-my, example2-my]
|
||||||
url: "https://www.gstatic.com/generate_204"
|
url: "https://www.gstatic.com/generate_204"
|
||||||
interval: 300
|
interval: 300
|
||||||
|
|||||||
@ -73,7 +73,8 @@ proxy-providers:
|
|||||||
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
||||||
# main provider saves (mihomo watches it; ./providers exists before the start,
|
# main provider saves (mihomo watches it; ./providers exists before the start,
|
||||||
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
||||||
# so the subscription is fetched once more.
|
# so the subscription is fetched once more. Nodes with an entry of their own
|
||||||
|
# (MY_NODE_ENTRIES) are left out here for <id>-my-via-<entry> (providers/16-myvia).
|
||||||
example-my:
|
example-my:
|
||||||
type: file
|
type: file
|
||||||
path: ./providers/example.yaml
|
path: ./providers/example.yaml
|
||||||
@ -92,7 +93,8 @@ proxy-providers:
|
|||||||
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
||||||
# main provider saves (mihomo watches it; ./providers exists before the start,
|
# main provider saves (mihomo watches it; ./providers exists before the start,
|
||||||
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
||||||
# so the subscription is fetched once more.
|
# so the subscription is fetched once more. Nodes with an entry of their own
|
||||||
|
# (MY_NODE_ENTRIES) are left out here for <id>-my-via-<entry> (providers/16-myvia).
|
||||||
example2-my:
|
example2-my:
|
||||||
type: file
|
type: file
|
||||||
path: ./providers/example2.yaml
|
path: ./providers/example2.yaml
|
||||||
|
|||||||
@ -17,12 +17,14 @@ proxies:
|
|||||||
|
|
||||||
# own servers of the settings (LuCI "Свои серверы", /etc/nikki/my-servers): one JSON
|
# own servers of the settings (LuCI "Свои серверы", /etc/nikki/my-servers): one JSON
|
||||||
# proxy per line, as mihomo's own config would have it; the kit puts dialer-proxy in
|
# proxy per line, as mihomo's own config would have it; the kit puts dialer-proxy in
|
||||||
# front: whitelist and the phone through MY-EXIT, else with UPLINK (CSQTT, pools) through it
|
# front: whitelist and the phone through MY-EXIT, else with UPLINK (CSQTT, pools) through it.
|
||||||
|
# A server with an entry of its own (LuCI "Вход") keeps it in every profile
|
||||||
- {"dialer-proxy": "UPLINK", "name":"🇩🇪 de 1","type":"vless","server":"x.example.com","port":"443","uuid":"00000000-0000-0000-0000-000000000001","udp":true,"tls":true,"client-fingerprint":"chrome","servername":"www.example.com","reality-opts":{"public-key":"Nc9ZSDuQMwHN4M6TeDHjfJhgZ6SBTBbfMwx5iHQZ1ns","short-id":"ab"},"xudp":true,"network":"xhttp","xhttp-opts":{"path":"/x"}}
|
- {"dialer-proxy": "UPLINK", "name":"🇩🇪 de 1","type":"vless","server":"x.example.com","port":"443","uuid":"00000000-0000-0000-0000-000000000001","udp":true,"tls":true,"client-fingerprint":"chrome","servername":"www.example.com","reality-opts":{"public-key":"Nc9ZSDuQMwHN4M6TeDHjfJhgZ6SBTBbfMwx5iHQZ1ns","short-id":"ab"},"xudp":true,"network":"xhttp","xhttp-opts":{"path":"/x"}}
|
||||||
- {"dialer-proxy": "UPLINK", "name":"tr \"q\"","type":"trojan","server":"t.example.org","port":"443","password":"p\u0024w","udp":true,"skip-cert-verify":false,"sni":"t.example.org","network":"grpc","grpc-opts":{"grpc-service-name":"g"},"client-fingerprint":"chrome"}
|
- {"dialer-proxy": "UPLINK", "name":"tr \"q\"","type":"trojan","server":"t.example.org","port":"443","password":"p\u0024w","udp":true,"skip-cert-verify":false,"sni":"t.example.org","network":"grpc","grpc-opts":{"grpc-service-name":"g"},"client-fingerprint":"chrome"}
|
||||||
- {"dialer-proxy": "UPLINK", "name":"hy-own","type":"hysteria2","server":"h.example.net","port":8443,"password":"a\u0024b","obfs":"salamander","obfs-password":"o","up":"50 mbps"}
|
- {"dialer-proxy": "UPLINK", "name":"hy-own","type":"hysteria2","server":"h.example.net","port":8443,"password":"a\u0024b","obfs":"salamander","obfs-password":"o","up":"50 mbps"}
|
||||||
- {"dialer-proxy": "UPLINK", "name":"awg-own","type":"wireguard","server":"203.0.113.10","port":47613,"ip":"10.8.1.2","private-key":"fTo2df+b5vCuulh7pOXMWiWJY2VwSe2Kuup2nA34tfI=","public-key":"vGYpG72gCXPNfYzr/0iNfSoL83vbrVSGUC+v+MKRVyE=","pre-shared-key":"6ut/J6EuaJ97RMFcZuiJkzIo7a5uxR98htK5NdWJW6E=","persistent-keepalive":25,"udp":true,"amnezia-wg-option":{"jc":4,"jmin":10,"jmax":50,"s1":98,"s2":32,"s3":19,"s4":7,"h1":"1458367412-1593426716","h2":"1863071624-1902347825","h3":"2091548318-2097143921","h4":"2112573893-2147191025","i1":"<r 2><b 0x858000010001000000000669636c6f756403636f6d0000010001c00c000100010000105a00044d583737>"}}
|
- {"dialer-proxy": "UPLINK", "name":"awg-own","type":"wireguard","server":"203.0.113.10","port":47613,"ip":"10.8.1.2","private-key":"fTo2df+b5vCuulh7pOXMWiWJY2VwSe2Kuup2nA34tfI=","public-key":"vGYpG72gCXPNfYzr/0iNfSoL83vbrVSGUC+v+MKRVyE=","pre-shared-key":"6ut/J6EuaJ97RMFcZuiJkzIo7a5uxR98htK5NdWJW6E=","persistent-keepalive":25,"udp":true,"amnezia-wg-option":{"jc":4,"jmin":10,"jmax":50,"s1":98,"s2":32,"s3":19,"s4":7,"h1":"1458367412-1593426716","h2":"1863071624-1902347825","h3":"2091548318-2097143921","h4":"2112573893-2147191025","i1":"<r 2><b 0x858000010001000000000669636c6f756403636f6d0000010001c00c000100010000105a00044d583737>"}}
|
||||||
- {"dialer-proxy": "UPLINK", "name":"nl-1","type":"hysteria2","server":"vpn.example.com","port":443,"password":"p","udp":true}
|
- {"dialer-proxy": "UPLINK", "name":"nl-1","type":"hysteria2","server":"vpn.example.com","port":443,"password":"p","udp":true}
|
||||||
|
- {"name":"via-foreign","type":"ss","server":"f.example.com","port":8388,"cipher":"aes-256-gcm","password":"x","dialer-proxy":"FOREIGN"}
|
||||||
|
|
||||||
# CSQTT (star-panel-csqtt): tunnel interface csqtt0 on the router, mihomo
|
# CSQTT (star-panel-csqtt): tunnel interface csqtt0 on the router, mihomo
|
||||||
# just sends the connection out of it (the interface does not change routes)
|
# just sends the connection out of it (the interface does not change routes)
|
||||||
@ -79,7 +81,8 @@ proxy-providers:
|
|||||||
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
||||||
# main provider saves (mihomo watches it; ./providers exists before the start,
|
# main provider saves (mihomo watches it; ./providers exists before the start,
|
||||||
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
||||||
# so the subscription is fetched once more.
|
# so the subscription is fetched once more. Nodes with an entry of their own
|
||||||
|
# (MY_NODE_ENTRIES) are left out here for <id>-my-via-<entry> (providers/16-myvia).
|
||||||
example-my:
|
example-my:
|
||||||
type: file
|
type: file
|
||||||
path: ./providers/example.yaml
|
path: ./providers/example.yaml
|
||||||
@ -98,7 +101,8 @@ proxy-providers:
|
|||||||
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
||||||
# main provider saves (mihomo watches it; ./providers exists before the start,
|
# main provider saves (mihomo watches it; ./providers exists before the start,
|
||||||
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
||||||
# so the subscription is fetched once more.
|
# so the subscription is fetched once more. Nodes with an entry of their own
|
||||||
|
# (MY_NODE_ENTRIES) are left out here for <id>-my-via-<entry> (providers/16-myvia).
|
||||||
example2-my:
|
example2-my:
|
||||||
type: file
|
type: file
|
||||||
path: ./providers/example2.yaml
|
path: ./providers/example2.yaml
|
||||||
@ -230,7 +234,7 @@ proxy-groups:
|
|||||||
# the subscriptions (providers <id>-my); the fastest alive one; pin one in the dashboard if needed
|
# the subscriptions (providers <id>-my); the fastest alive one; pin one in the dashboard if needed
|
||||||
- name: MY
|
- name: MY
|
||||||
type: url-test
|
type: url-test
|
||||||
proxies: ["🇩🇪 de 1", "tr \"q\"", "hy-own", "awg-own", "nl-1"]
|
proxies: ["🇩🇪 de 1", "tr \"q\"", "hy-own", "awg-own", "via-foreign", "nl-1"]
|
||||||
use: [example-my, example2-my]
|
use: [example-my, example2-my]
|
||||||
url: "https://www.gstatic.com/generate_204"
|
url: "https://www.gstatic.com/generate_204"
|
||||||
interval: 300
|
interval: 300
|
||||||
|
|||||||
@ -17,11 +17,13 @@ proxies:
|
|||||||
|
|
||||||
# own servers of the settings (LuCI "Свои серверы", /etc/nikki/my-servers): one JSON
|
# own servers of the settings (LuCI "Свои серверы", /etc/nikki/my-servers): one JSON
|
||||||
# proxy per line, as mihomo's own config would have it; the kit puts dialer-proxy in
|
# proxy per line, as mihomo's own config would have it; the kit puts dialer-proxy in
|
||||||
# front: whitelist and the phone through MY-EXIT, else with UPLINK (CSQTT, pools) through it
|
# front: whitelist and the phone through MY-EXIT, else with UPLINK (CSQTT, pools) through it.
|
||||||
|
# A server with an entry of its own (LuCI "Вход") keeps it in every profile
|
||||||
- {"dialer-proxy": "MY-EXIT", "name":"🇩🇪 de 1","type":"vless","server":"x.example.com","port":"443","uuid":"00000000-0000-0000-0000-000000000001","udp":true,"tls":true,"client-fingerprint":"chrome","servername":"www.example.com","reality-opts":{"public-key":"Nc9ZSDuQMwHN4M6TeDHjfJhgZ6SBTBbfMwx5iHQZ1ns","short-id":"ab"},"xudp":true,"network":"xhttp","xhttp-opts":{"path":"/x"}}
|
- {"dialer-proxy": "MY-EXIT", "name":"🇩🇪 de 1","type":"vless","server":"x.example.com","port":"443","uuid":"00000000-0000-0000-0000-000000000001","udp":true,"tls":true,"client-fingerprint":"chrome","servername":"www.example.com","reality-opts":{"public-key":"Nc9ZSDuQMwHN4M6TeDHjfJhgZ6SBTBbfMwx5iHQZ1ns","short-id":"ab"},"xudp":true,"network":"xhttp","xhttp-opts":{"path":"/x"}}
|
||||||
- {"dialer-proxy": "MY-EXIT", "name":"tr \"q\"","type":"trojan","server":"t.example.org","port":"443","password":"p\u0024w","udp":true,"skip-cert-verify":false,"sni":"t.example.org","network":"grpc","grpc-opts":{"grpc-service-name":"g"},"client-fingerprint":"chrome"}
|
- {"dialer-proxy": "MY-EXIT", "name":"tr \"q\"","type":"trojan","server":"t.example.org","port":"443","password":"p\u0024w","udp":true,"skip-cert-verify":false,"sni":"t.example.org","network":"grpc","grpc-opts":{"grpc-service-name":"g"},"client-fingerprint":"chrome"}
|
||||||
- {"dialer-proxy": "MY-EXIT", "name":"hy-own","type":"hysteria2","server":"h.example.net","port":8443,"password":"a\u0024b","obfs":"salamander","obfs-password":"o","up":"50 mbps"}
|
- {"dialer-proxy": "MY-EXIT", "name":"hy-own","type":"hysteria2","server":"h.example.net","port":8443,"password":"a\u0024b","obfs":"salamander","obfs-password":"o","up":"50 mbps"}
|
||||||
- {"dialer-proxy": "MY-EXIT", "name":"awg-own","type":"wireguard","server":"203.0.113.10","port":47613,"ip":"10.8.1.2","private-key":"fTo2df+b5vCuulh7pOXMWiWJY2VwSe2Kuup2nA34tfI=","public-key":"vGYpG72gCXPNfYzr/0iNfSoL83vbrVSGUC+v+MKRVyE=","pre-shared-key":"6ut/J6EuaJ97RMFcZuiJkzIo7a5uxR98htK5NdWJW6E=","persistent-keepalive":25,"udp":true,"amnezia-wg-option":{"jc":4,"jmin":10,"jmax":50,"s1":98,"s2":32,"s3":19,"s4":7,"h1":"1458367412-1593426716","h2":"1863071624-1902347825","h3":"2091548318-2097143921","h4":"2112573893-2147191025","i1":"<r 2><b 0x858000010001000000000669636c6f756403636f6d0000010001c00c000100010000105a00044d583737>"}}
|
- {"dialer-proxy": "MY-EXIT", "name":"awg-own","type":"wireguard","server":"203.0.113.10","port":47613,"ip":"10.8.1.2","private-key":"fTo2df+b5vCuulh7pOXMWiWJY2VwSe2Kuup2nA34tfI=","public-key":"vGYpG72gCXPNfYzr/0iNfSoL83vbrVSGUC+v+MKRVyE=","pre-shared-key":"6ut/J6EuaJ97RMFcZuiJkzIo7a5uxR98htK5NdWJW6E=","persistent-keepalive":25,"udp":true,"amnezia-wg-option":{"jc":4,"jmin":10,"jmax":50,"s1":98,"s2":32,"s3":19,"s4":7,"h1":"1458367412-1593426716","h2":"1863071624-1902347825","h3":"2091548318-2097143921","h4":"2112573893-2147191025","i1":"<r 2><b 0x858000010001000000000669636c6f756403636f6d0000010001c00c000100010000105a00044d583737>"}}
|
||||||
|
- {"name":"via-foreign","type":"ss","server":"f.example.com","port":8388,"cipher":"aes-256-gcm","password":"x","dialer-proxy":"FOREIGN"}
|
||||||
|
|
||||||
# CSQTT (star-panel-csqtt): tunnel interface csqtt0 on the router, mihomo
|
# CSQTT (star-panel-csqtt): tunnel interface csqtt0 on the router, mihomo
|
||||||
# just sends the connection out of it (the interface does not change routes)
|
# just sends the connection out of it (the interface does not change routes)
|
||||||
@ -78,7 +80,8 @@ proxy-providers:
|
|||||||
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
||||||
# main provider saves (mihomo watches it; ./providers exists before the start,
|
# main provider saves (mihomo watches it; ./providers exists before the start,
|
||||||
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
||||||
# so the subscription is fetched once more.
|
# so the subscription is fetched once more. Nodes with an entry of their own
|
||||||
|
# (MY_NODE_ENTRIES) are left out here for <id>-my-via-<entry> (providers/16-myvia).
|
||||||
example-my:
|
example-my:
|
||||||
type: file
|
type: file
|
||||||
path: ./providers/example.yaml
|
path: ./providers/example.yaml
|
||||||
@ -97,7 +100,8 @@ proxy-providers:
|
|||||||
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
||||||
# main provider saves (mihomo watches it; ./providers exists before the start,
|
# main provider saves (mihomo watches it; ./providers exists before the start,
|
||||||
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
||||||
# so the subscription is fetched once more.
|
# so the subscription is fetched once more. Nodes with an entry of their own
|
||||||
|
# (MY_NODE_ENTRIES) are left out here for <id>-my-via-<entry> (providers/16-myvia).
|
||||||
example2-my:
|
example2-my:
|
||||||
type: file
|
type: file
|
||||||
path: ./providers/example2.yaml
|
path: ./providers/example2.yaml
|
||||||
@ -232,7 +236,7 @@ proxy-groups:
|
|||||||
# the subscriptions (providers <id>-my); the fastest alive one; pin one in the dashboard if needed
|
# the subscriptions (providers <id>-my); the fastest alive one; pin one in the dashboard if needed
|
||||||
- name: MY
|
- name: MY
|
||||||
type: url-test
|
type: url-test
|
||||||
proxies: ["🇩🇪 de 1", "tr \"q\"", "hy-own", "awg-own"]
|
proxies: ["🇩🇪 de 1", "tr \"q\"", "hy-own", "awg-own", "via-foreign"]
|
||||||
use: [example-my, example2-my]
|
use: [example-my, example2-my]
|
||||||
url: "https://www.gstatic.com/generate_204"
|
url: "https://www.gstatic.com/generate_204"
|
||||||
interval: 300
|
interval: 300
|
||||||
|
|||||||
@ -27,7 +27,8 @@ proxies:
|
|||||||
|
|
||||||
# own servers of the settings (LuCI "Свои серверы", /etc/nikki/my-servers): one JSON
|
# own servers of the settings (LuCI "Свои серверы", /etc/nikki/my-servers): one JSON
|
||||||
# proxy per line, as mihomo's own config would have it; the kit puts dialer-proxy in
|
# proxy per line, as mihomo's own config would have it; the kit puts dialer-proxy in
|
||||||
# front: whitelist and the phone through MY-EXIT, else with UPLINK (CSQTT, pools) through it
|
# front: whitelist and the phone through MY-EXIT, else with UPLINK (CSQTT, pools) through it.
|
||||||
|
# A server with an entry of its own (LuCI "Вход") keeps it in every profile
|
||||||
- {"name":"nl-1","type":"hysteria2","server":"vpn.example.com","port":443,"password":"p","udp":true}
|
- {"name":"nl-1","type":"hysteria2","server":"vpn.example.com","port":443,"password":"p","udp":true}
|
||||||
|
|
||||||
proxy-providers:
|
proxy-providers:
|
||||||
@ -74,7 +75,8 @@ proxy-providers:
|
|||||||
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
||||||
# main provider saves (mihomo watches it; ./providers exists before the start,
|
# main provider saves (mihomo watches it; ./providers exists before the start,
|
||||||
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
||||||
# so the subscription is fetched once more.
|
# so the subscription is fetched once more. Nodes with an entry of their own
|
||||||
|
# (MY_NODE_ENTRIES) are left out here for <id>-my-via-<entry> (providers/16-myvia).
|
||||||
example-my:
|
example-my:
|
||||||
type: file
|
type: file
|
||||||
path: ./providers/example.yaml
|
path: ./providers/example.yaml
|
||||||
@ -91,7 +93,8 @@ proxy-providers:
|
|||||||
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
||||||
# main provider saves (mihomo watches it; ./providers exists before the start,
|
# main provider saves (mihomo watches it; ./providers exists before the start,
|
||||||
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
||||||
# so the subscription is fetched once more.
|
# so the subscription is fetched once more. Nodes with an entry of their own
|
||||||
|
# (MY_NODE_ENTRIES) are left out here for <id>-my-via-<entry> (providers/16-myvia).
|
||||||
example2-my:
|
example2-my:
|
||||||
type: file
|
type: file
|
||||||
path: ./providers/example2.yaml
|
path: ./providers/example2.yaml
|
||||||
|
|||||||
@ -64,7 +64,8 @@ proxy-providers:
|
|||||||
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
||||||
# main provider saves (mihomo watches it; ./providers exists before the start,
|
# main provider saves (mihomo watches it; ./providers exists before the start,
|
||||||
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
||||||
# so the subscription is fetched once more.
|
# so the subscription is fetched once more. Nodes with an entry of their own
|
||||||
|
# (MY_NODE_ENTRIES) are left out here for <id>-my-via-<entry> (providers/16-myvia).
|
||||||
example-my:
|
example-my:
|
||||||
type: file
|
type: file
|
||||||
path: ./providers/example.yaml
|
path: ./providers/example.yaml
|
||||||
@ -81,7 +82,8 @@ proxy-providers:
|
|||||||
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
||||||
# main provider saves (mihomo watches it; ./providers exists before the start,
|
# main provider saves (mihomo watches it; ./providers exists before the start,
|
||||||
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
||||||
# so the subscription is fetched once more.
|
# so the subscription is fetched once more. Nodes with an entry of their own
|
||||||
|
# (MY_NODE_ENTRIES) are left out here for <id>-my-via-<entry> (providers/16-myvia).
|
||||||
example2-my:
|
example2-my:
|
||||||
type: file
|
type: file
|
||||||
path: ./providers/example2.yaml
|
path: ./providers/example2.yaml
|
||||||
|
|||||||
@ -82,7 +82,8 @@ proxy-providers:
|
|||||||
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
||||||
# main provider saves (mihomo watches it; ./providers exists before the start,
|
# main provider saves (mihomo watches it; ./providers exists before the start,
|
||||||
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
||||||
# so the subscription is fetched once more.
|
# so the subscription is fetched once more. Nodes with an entry of their own
|
||||||
|
# (MY_NODE_ENTRIES) are left out here for <id>-my-via-<entry> (providers/16-myvia).
|
||||||
kitty-my:
|
kitty-my:
|
||||||
type: file
|
type: file
|
||||||
path: ./providers/kitty.yaml
|
path: ./providers/kitty.yaml
|
||||||
@ -99,7 +100,8 @@ proxy-providers:
|
|||||||
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
||||||
# main provider saves (mihomo watches it; ./providers exists before the start,
|
# main provider saves (mihomo watches it; ./providers exists before the start,
|
||||||
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
||||||
# so the subscription is fetched once more.
|
# so the subscription is fetched once more. Nodes with an entry of their own
|
||||||
|
# (MY_NODE_ENTRIES) are left out here for <id>-my-via-<entry> (providers/16-myvia).
|
||||||
vpn_host-my:
|
vpn_host-my:
|
||||||
type: file
|
type: file
|
||||||
path: ./providers/vpn_host.yaml
|
path: ./providers/vpn_host.yaml
|
||||||
@ -116,7 +118,8 @@ proxy-providers:
|
|||||||
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
||||||
# main provider saves (mihomo watches it; ./providers exists before the start,
|
# main provider saves (mihomo watches it; ./providers exists before the start,
|
||||||
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
||||||
# so the subscription is fetched once more.
|
# so the subscription is fetched once more. Nodes with an entry of their own
|
||||||
|
# (MY_NODE_ENTRIES) are left out here for <id>-my-via-<entry> (providers/16-myvia).
|
||||||
sub3-my:
|
sub3-my:
|
||||||
type: file
|
type: file
|
||||||
path: ./providers/sub3.yaml
|
path: ./providers/sub3.yaml
|
||||||
|
|||||||
@ -77,7 +77,8 @@ proxy-providers:
|
|||||||
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
||||||
# main provider saves (mihomo watches it; ./providers exists before the start,
|
# main provider saves (mihomo watches it; ./providers exists before the start,
|
||||||
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
||||||
# so the subscription is fetched once more.
|
# so the subscription is fetched once more. Nodes with an entry of their own
|
||||||
|
# (MY_NODE_ENTRIES) are left out here for <id>-my-via-<entry> (providers/16-myvia).
|
||||||
example-my:
|
example-my:
|
||||||
type: file
|
type: file
|
||||||
path: ./providers/example.yaml
|
path: ./providers/example.yaml
|
||||||
@ -96,7 +97,8 @@ proxy-providers:
|
|||||||
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
||||||
# main provider saves (mihomo watches it; ./providers exists before the start,
|
# main provider saves (mihomo watches it; ./providers exists before the start,
|
||||||
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
||||||
# so the subscription is fetched once more.
|
# so the subscription is fetched once more. Nodes with an entry of their own
|
||||||
|
# (MY_NODE_ENTRIES) are left out here for <id>-my-via-<entry> (providers/16-myvia).
|
||||||
example2-my:
|
example2-my:
|
||||||
type: file
|
type: file
|
||||||
path: ./providers/example2.yaml
|
path: ./providers/example2.yaml
|
||||||
|
|||||||
@ -24,7 +24,8 @@ proxies:
|
|||||||
|
|
||||||
# own servers of the settings (LuCI "Свои серверы", /etc/nikki/my-servers): one JSON
|
# own servers of the settings (LuCI "Свои серверы", /etc/nikki/my-servers): one JSON
|
||||||
# proxy per line, as mihomo's own config would have it; the kit puts dialer-proxy in
|
# proxy per line, as mihomo's own config would have it; the kit puts dialer-proxy in
|
||||||
# front: whitelist and the phone through MY-EXIT, else with UPLINK (CSQTT, pools) through it
|
# front: whitelist and the phone through MY-EXIT, else with UPLINK (CSQTT, pools) through it.
|
||||||
|
# A server with an entry of its own (LuCI "Вход") keeps it in every profile
|
||||||
- {"dialer-proxy": "MY-EXIT", "name":"nl-1","type":"hysteria2","server":"vpn.example.com","port":443,"password":"p","udp":true}
|
- {"dialer-proxy": "MY-EXIT", "name":"nl-1","type":"hysteria2","server":"vpn.example.com","port":443,"password":"p","udp":true}
|
||||||
|
|
||||||
proxy-providers:
|
proxy-providers:
|
||||||
@ -71,7 +72,8 @@ proxy-providers:
|
|||||||
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
||||||
# main provider saves (mihomo watches it; ./providers exists before the start,
|
# main provider saves (mihomo watches it; ./providers exists before the start,
|
||||||
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
||||||
# so the subscription is fetched once more.
|
# so the subscription is fetched once more. Nodes with an entry of their own
|
||||||
|
# (MY_NODE_ENTRIES) are left out here for <id>-my-via-<entry> (providers/16-myvia).
|
||||||
example-my:
|
example-my:
|
||||||
type: file
|
type: file
|
||||||
path: ./providers/example.yaml
|
path: ./providers/example.yaml
|
||||||
@ -90,7 +92,8 @@ proxy-providers:
|
|||||||
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
||||||
# main provider saves (mihomo watches it; ./providers exists before the start,
|
# main provider saves (mihomo watches it; ./providers exists before the start,
|
||||||
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
||||||
# so the subscription is fetched once more.
|
# so the subscription is fetched once more. Nodes with an entry of their own
|
||||||
|
# (MY_NODE_ENTRIES) are left out here for <id>-my-via-<entry> (providers/16-myvia).
|
||||||
example2-my:
|
example2-my:
|
||||||
type: file
|
type: file
|
||||||
path: ./providers/example2.yaml
|
path: ./providers/example2.yaml
|
||||||
|
|||||||
@ -27,12 +27,14 @@ proxies:
|
|||||||
|
|
||||||
# own servers of the settings (LuCI "Свои серверы", /etc/nikki/my-servers): one JSON
|
# own servers of the settings (LuCI "Свои серверы", /etc/nikki/my-servers): one JSON
|
||||||
# proxy per line, as mihomo's own config would have it; the kit puts dialer-proxy in
|
# proxy per line, as mihomo's own config would have it; the kit puts dialer-proxy in
|
||||||
# front: whitelist and the phone through MY-EXIT, else with UPLINK (CSQTT, pools) through it
|
# front: whitelist and the phone through MY-EXIT, else with UPLINK (CSQTT, pools) through it.
|
||||||
|
# A server with an entry of its own (LuCI "Вход") keeps it in every profile
|
||||||
- {"name":"🇩🇪 de 1","type":"vless","server":"x.example.com","port":"443","uuid":"00000000-0000-0000-0000-000000000001","udp":true,"tls":true,"client-fingerprint":"chrome","servername":"www.example.com","reality-opts":{"public-key":"Nc9ZSDuQMwHN4M6TeDHjfJhgZ6SBTBbfMwx5iHQZ1ns","short-id":"ab"},"xudp":true,"network":"xhttp","xhttp-opts":{"path":"/x"}}
|
- {"name":"🇩🇪 de 1","type":"vless","server":"x.example.com","port":"443","uuid":"00000000-0000-0000-0000-000000000001","udp":true,"tls":true,"client-fingerprint":"chrome","servername":"www.example.com","reality-opts":{"public-key":"Nc9ZSDuQMwHN4M6TeDHjfJhgZ6SBTBbfMwx5iHQZ1ns","short-id":"ab"},"xudp":true,"network":"xhttp","xhttp-opts":{"path":"/x"}}
|
||||||
- {"name":"tr \"q\"","type":"trojan","server":"t.example.org","port":"443","password":"p\u0024w","udp":true,"skip-cert-verify":false,"sni":"t.example.org","network":"grpc","grpc-opts":{"grpc-service-name":"g"},"client-fingerprint":"chrome"}
|
- {"name":"tr \"q\"","type":"trojan","server":"t.example.org","port":"443","password":"p\u0024w","udp":true,"skip-cert-verify":false,"sni":"t.example.org","network":"grpc","grpc-opts":{"grpc-service-name":"g"},"client-fingerprint":"chrome"}
|
||||||
- {"name":"hy-own","type":"hysteria2","server":"h.example.net","port":8443,"password":"a\u0024b","obfs":"salamander","obfs-password":"o","up":"50 mbps"}
|
- {"name":"hy-own","type":"hysteria2","server":"h.example.net","port":8443,"password":"a\u0024b","obfs":"salamander","obfs-password":"o","up":"50 mbps"}
|
||||||
- {"name":"awg-own","type":"wireguard","server":"203.0.113.10","port":47613,"ip":"10.8.1.2","private-key":"fTo2df+b5vCuulh7pOXMWiWJY2VwSe2Kuup2nA34tfI=","public-key":"vGYpG72gCXPNfYzr/0iNfSoL83vbrVSGUC+v+MKRVyE=","pre-shared-key":"6ut/J6EuaJ97RMFcZuiJkzIo7a5uxR98htK5NdWJW6E=","persistent-keepalive":25,"udp":true,"amnezia-wg-option":{"jc":4,"jmin":10,"jmax":50,"s1":98,"s2":32,"s3":19,"s4":7,"h1":"1458367412-1593426716","h2":"1863071624-1902347825","h3":"2091548318-2097143921","h4":"2112573893-2147191025","i1":"<r 2><b 0x858000010001000000000669636c6f756403636f6d0000010001c00c000100010000105a00044d583737>"}}
|
- {"name":"awg-own","type":"wireguard","server":"203.0.113.10","port":47613,"ip":"10.8.1.2","private-key":"fTo2df+b5vCuulh7pOXMWiWJY2VwSe2Kuup2nA34tfI=","public-key":"vGYpG72gCXPNfYzr/0iNfSoL83vbrVSGUC+v+MKRVyE=","pre-shared-key":"6ut/J6EuaJ97RMFcZuiJkzIo7a5uxR98htK5NdWJW6E=","persistent-keepalive":25,"udp":true,"amnezia-wg-option":{"jc":4,"jmin":10,"jmax":50,"s1":98,"s2":32,"s3":19,"s4":7,"h1":"1458367412-1593426716","h2":"1863071624-1902347825","h3":"2091548318-2097143921","h4":"2112573893-2147191025","i1":"<r 2><b 0x858000010001000000000669636c6f756403636f6d0000010001c00c000100010000105a00044d583737>"}}
|
||||||
- {"name":"home-hy","type":"hysteria2","server":"1.1.1.1","port":443,"password":"x","udp":true}
|
- {"name":"home-hy","type":"hysteria2","server":"1.1.1.1","port":443,"password":"x","udp":true}
|
||||||
|
- {"name":"via-foreign","type":"ss","server":"f.example.com","port":8388,"cipher":"aes-256-gcm","password":"x","dialer-proxy":"FOREIGN"}
|
||||||
|
|
||||||
proxy-providers:
|
proxy-providers:
|
||||||
example:
|
example:
|
||||||
@ -78,7 +80,8 @@ proxy-providers:
|
|||||||
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
||||||
# main provider saves (mihomo watches it; ./providers exists before the start,
|
# main provider saves (mihomo watches it; ./providers exists before the start,
|
||||||
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
||||||
# so the subscription is fetched once more.
|
# so the subscription is fetched once more. Nodes with an entry of their own
|
||||||
|
# (MY_NODE_ENTRIES) are left out here for <id>-my-via-<entry> (providers/16-myvia).
|
||||||
example-my:
|
example-my:
|
||||||
type: file
|
type: file
|
||||||
path: ./providers/example.yaml
|
path: ./providers/example.yaml
|
||||||
@ -95,7 +98,8 @@ proxy-providers:
|
|||||||
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
||||||
# main provider saves (mihomo watches it; ./providers exists before the start,
|
# main provider saves (mihomo watches it; ./providers exists before the start,
|
||||||
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
||||||
# so the subscription is fetched once more.
|
# so the subscription is fetched once more. Nodes with an entry of their own
|
||||||
|
# (MY_NODE_ENTRIES) are left out here for <id>-my-via-<entry> (providers/16-myvia).
|
||||||
example2-my:
|
example2-my:
|
||||||
type: file
|
type: file
|
||||||
path: ./providers/example2.yaml
|
path: ./providers/example2.yaml
|
||||||
@ -268,7 +272,7 @@ proxy-groups:
|
|||||||
# the subscriptions (providers <id>-my); the fastest alive one; pin one in the dashboard if needed
|
# the subscriptions (providers <id>-my); the fastest alive one; pin one in the dashboard if needed
|
||||||
- name: MY
|
- name: MY
|
||||||
type: url-test
|
type: url-test
|
||||||
proxies: ["🇩🇪 de 1", "tr \"q\"", "hy-own", "awg-own", "home-hy"]
|
proxies: ["🇩🇪 de 1", "tr \"q\"", "hy-own", "awg-own", "via-foreign", "home-hy"]
|
||||||
use: [example-my, example2-my]
|
use: [example-my, example2-my]
|
||||||
url: "https://www.gstatic.com/generate_204"
|
url: "https://www.gstatic.com/generate_204"
|
||||||
interval: 300
|
interval: 300
|
||||||
|
|||||||
@ -42,7 +42,8 @@ proxy-providers:
|
|||||||
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
||||||
# main provider saves (mihomo watches it; ./providers exists before the start,
|
# main provider saves (mihomo watches it; ./providers exists before the start,
|
||||||
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
||||||
# so the subscription is fetched once more.
|
# so the subscription is fetched once more. Nodes with an entry of their own
|
||||||
|
# (MY_NODE_ENTRIES) are left out here for <id>-my-via-<entry> (providers/16-myvia).
|
||||||
example-my:
|
example-my:
|
||||||
type: file
|
type: file
|
||||||
path: ./providers/example.yaml
|
path: ./providers/example.yaml
|
||||||
@ -59,7 +60,8 @@ proxy-providers:
|
|||||||
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
||||||
# main provider saves (mihomo watches it; ./providers exists before the start,
|
# main provider saves (mihomo watches it; ./providers exists before the start,
|
||||||
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
||||||
# so the subscription is fetched once more.
|
# so the subscription is fetched once more. Nodes with an entry of their own
|
||||||
|
# (MY_NODE_ENTRIES) are left out here for <id>-my-via-<entry> (providers/16-myvia).
|
||||||
example2-my:
|
example2-my:
|
||||||
type: file
|
type: file
|
||||||
path: ./providers/example2.yaml
|
path: ./providers/example2.yaml
|
||||||
|
|||||||
366
tests/expected/router-myvia.yaml
Normal file
366
tests/expected/router-myvia.yaml
Normal file
@ -0,0 +1,366 @@
|
|||||||
|
proxies:
|
||||||
|
- name: seed
|
||||||
|
type: vless
|
||||||
|
server: 1.2.3.4
|
||||||
|
port: 443
|
||||||
|
uuid: 00000000-0000-0000-0000-000000000000
|
||||||
|
network: tcp
|
||||||
|
udp: true
|
||||||
|
tls: true
|
||||||
|
flow: xtls-rprx-vision
|
||||||
|
servername: eh.vk.ru
|
||||||
|
client-fingerprint: firefox
|
||||||
|
reality-opts:
|
||||||
|
public-key: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
short-id: a1b2
|
||||||
|
|
||||||
|
proxy-providers:
|
||||||
|
example:
|
||||||
|
type: http
|
||||||
|
url: "https://sub.example.com/sub/aaa"
|
||||||
|
path: ./providers/example.yaml
|
||||||
|
interval: 3600
|
||||||
|
proxy: BOOT-AUTO
|
||||||
|
exclude-filter: "(?i)app not supported|приложение не|свяжитесь|\\[MY\\]"
|
||||||
|
header:
|
||||||
|
User-Agent: ["mihomo"]
|
||||||
|
# one check per provider: the groups over it (use:) only add their URLs to it,
|
||||||
|
# so the interval and lazy here are what counts for RU/FOREIGN/TORRENT/MY-EXIT.
|
||||||
|
# lite: every 10 min and skipped while no traffic used the provider
|
||||||
|
health-check:
|
||||||
|
enable: true
|
||||||
|
url: "https://www.gstatic.com/generate_204"
|
||||||
|
interval: 300
|
||||||
|
timeout: 3000
|
||||||
|
lazy: false
|
||||||
|
|
||||||
|
example2:
|
||||||
|
type: http
|
||||||
|
url: "https://sub2.example.com/x?a=1&b=2"
|
||||||
|
path: ./providers/example2.yaml
|
||||||
|
interval: 3600
|
||||||
|
proxy: BOOT-AUTO
|
||||||
|
exclude-filter: "(?i)app not supported|приложение не|свяжитесь|\\[MY\\]"
|
||||||
|
header:
|
||||||
|
User-Agent: ["mihomo"]
|
||||||
|
# one check per provider: the groups over it (use:) only add their URLs to it,
|
||||||
|
# so the interval and lazy here are what counts for RU/FOREIGN/TORRENT/MY-EXIT.
|
||||||
|
# lite: every 10 min and skipped while no traffic used the provider
|
||||||
|
health-check:
|
||||||
|
enable: true
|
||||||
|
url: "https://www.gstatic.com/generate_204"
|
||||||
|
interval: 300
|
||||||
|
timeout: 3000
|
||||||
|
lazy: false
|
||||||
|
|
||||||
|
# own servers kept in the subscription, named "[MY] ...", for group MY (the main
|
||||||
|
# provider leaves them out); a provider of its own because on whitelist and the
|
||||||
|
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
||||||
|
# main provider saves (mihomo watches it; ./providers exists before the start,
|
||||||
|
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
||||||
|
# so the subscription is fetched once more. Nodes with an entry of their own
|
||||||
|
# (MY_NODE_ENTRIES) are left out here for <id>-my-via-<entry> (providers/16-myvia).
|
||||||
|
example-my:
|
||||||
|
type: file
|
||||||
|
path: ./providers/example.yaml
|
||||||
|
filter: "(?i)\\[MY\\]"
|
||||||
|
exclude-filter: "^(\\[MY\\] 🇩🇪 de-1 \\(a\\)|\\[MY\\] nl\\.2)$"
|
||||||
|
override:
|
||||||
|
dialer-proxy: MY-EXIT
|
||||||
|
health-check:
|
||||||
|
enable: true
|
||||||
|
url: "https://www.gstatic.com/generate_204"
|
||||||
|
interval: 300
|
||||||
|
timeout: 3000
|
||||||
|
lazy: false
|
||||||
|
|
||||||
|
# own servers kept in the subscription, named "[MY] ...", for group MY (the main
|
||||||
|
# provider leaves them out); a provider of its own because on whitelist and the
|
||||||
|
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
||||||
|
# main provider saves (mihomo watches it; ./providers exists before the start,
|
||||||
|
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
||||||
|
# so the subscription is fetched once more. Nodes with an entry of their own
|
||||||
|
# (MY_NODE_ENTRIES) are left out here for <id>-my-via-<entry> (providers/16-myvia).
|
||||||
|
example2-my:
|
||||||
|
type: file
|
||||||
|
path: ./providers/example2.yaml
|
||||||
|
filter: "(?i)\\[MY\\]"
|
||||||
|
exclude-filter: "^(\\[MY\\] fi\\x603)$"
|
||||||
|
override:
|
||||||
|
dialer-proxy: MY-EXIT
|
||||||
|
health-check:
|
||||||
|
enable: true
|
||||||
|
url: "https://www.gstatic.com/generate_204"
|
||||||
|
interval: 300
|
||||||
|
timeout: 3000
|
||||||
|
lazy: false
|
||||||
|
|
||||||
|
# [MY] nodes of example with an entry of their own (LuCI «Свои серверы» → «Вход»):
|
||||||
|
# out of example-my, dialing through FOREIGN in every profile
|
||||||
|
example-my-via-FOREIGN:
|
||||||
|
type: file
|
||||||
|
path: ./providers/example.yaml
|
||||||
|
filter: "^(\\[MY\\] 🇩🇪 de-1 \\(a\\)|\\[MY\\] nl\\.2)$"
|
||||||
|
override:
|
||||||
|
dialer-proxy: FOREIGN
|
||||||
|
health-check:
|
||||||
|
enable: true
|
||||||
|
url: "https://www.gstatic.com/generate_204"
|
||||||
|
interval: 300
|
||||||
|
timeout: 3000
|
||||||
|
lazy: false
|
||||||
|
|
||||||
|
# [MY] nodes of example2 with an entry of their own (LuCI «Свои серверы» → «Вход»):
|
||||||
|
# out of example2-my, dialing through DE in every profile
|
||||||
|
example2-my-via-DE:
|
||||||
|
type: file
|
||||||
|
path: ./providers/example2.yaml
|
||||||
|
filter: "^(\\[MY\\] fi\\x603)$"
|
||||||
|
override:
|
||||||
|
dialer-proxy: DE
|
||||||
|
health-check:
|
||||||
|
enable: true
|
||||||
|
url: "https://www.gstatic.com/generate_204"
|
||||||
|
interval: 300
|
||||||
|
timeout: 3000
|
||||||
|
lazy: false
|
||||||
|
|
||||||
|
# example-my for the chains through RU: the same nodes, named "... ⟶ RU"
|
||||||
|
example-my@RU:
|
||||||
|
type: file
|
||||||
|
path: ./providers/example.yaml
|
||||||
|
filter: "(?i)\\[MY\\]"
|
||||||
|
override:
|
||||||
|
additional-suffix: " ⟶ RU"
|
||||||
|
dialer-proxy: RU
|
||||||
|
health-check:
|
||||||
|
enable: true
|
||||||
|
url: "https://www.gstatic.com/generate_204"
|
||||||
|
interval: 300
|
||||||
|
timeout: 3000
|
||||||
|
lazy: false
|
||||||
|
|
||||||
|
rule-providers:
|
||||||
|
# Russian services (geosite ru-inside of russia-only, as .mrs): an ordinary
|
||||||
|
# http rule-set, so every client fetches it with the config, no geodata setup
|
||||||
|
ru-inside:
|
||||||
|
type: http
|
||||||
|
behavior: domain
|
||||||
|
format: mrs
|
||||||
|
url: "https://cdn.jsdelivr.net/gh/SamLatsin/russia-only@release/ru-inside.mrs"
|
||||||
|
path: ./ruleset/ru-inside.mrs
|
||||||
|
interval: 86400
|
||||||
|
# Russian services outside ru-inside and outside .ru/.su/.рф (russia-only ru-services):
|
||||||
|
# not on the whitelist, so through RU everywhere but main
|
||||||
|
ru-services:
|
||||||
|
type: http
|
||||||
|
behavior: domain
|
||||||
|
format: mrs
|
||||||
|
url: "https://cdn.jsdelivr.net/gh/SamLatsin/russia-only@release/ru-services.mrs"
|
||||||
|
path: ./ruleset/ru-services.mrs
|
||||||
|
interval: 86400
|
||||||
|
|
||||||
|
sniffer:
|
||||||
|
enable: true
|
||||||
|
force-dns-mapping: true
|
||||||
|
parse-pure-ip: true
|
||||||
|
override-destination: false
|
||||||
|
# ECH: browsers show the outer name cloudflare-ech.com instead of the site behind
|
||||||
|
# Cloudflare; the sniffed name wins in the rules, so .ru / own lists would miss the
|
||||||
|
# site. Skipped: the rules see the name from mihomo's DNS (fake-ip / DNS mapping).
|
||||||
|
skip-domain:
|
||||||
|
- "+.cloudflare-ech.com"
|
||||||
|
sniff:
|
||||||
|
HTTP:
|
||||||
|
ports: [80, 8080-8880]
|
||||||
|
TLS:
|
||||||
|
ports: [443, 8443]
|
||||||
|
# lite: no QUIC (fake-ip already gives the domain; pure-IP QUIC goes by IP)
|
||||||
|
QUIC:
|
||||||
|
ports: [443, 8443]
|
||||||
|
|
||||||
|
dns:
|
||||||
|
enable: true
|
||||||
|
ipv6: false
|
||||||
|
respect-rules: true
|
||||||
|
enhanced-mode: fake-ip
|
||||||
|
fake-ip-range: 198.18.0.1/16
|
||||||
|
fake-ip-filter:
|
||||||
|
- '*.lan'
|
||||||
|
- '*.local'
|
||||||
|
- '+.ru'
|
||||||
|
- '+.xn--p1ai'
|
||||||
|
- rule-set:ru-inside
|
||||||
|
|
||||||
|
default-nameserver:
|
||||||
|
- 77.88.8.8
|
||||||
|
- 1.1.1.1
|
||||||
|
|
||||||
|
proxy-server-nameserver:
|
||||||
|
- https://77.88.8.8/dns-query
|
||||||
|
|
||||||
|
direct-nameserver:
|
||||||
|
- 77.88.8.8
|
||||||
|
- 77.88.8.1
|
||||||
|
|
||||||
|
nameserver:
|
||||||
|
- https://1.1.1.1/dns-query
|
||||||
|
- https://dns.google/dns-query
|
||||||
|
|
||||||
|
proxy-groups:
|
||||||
|
# BOOT: whitelisted entry nodes (BOOT_LINKS), the first alive one
|
||||||
|
- name: BOOT
|
||||||
|
type: fallback
|
||||||
|
proxies: [seed]
|
||||||
|
url: "https://www.gstatic.com/generate_204"
|
||||||
|
interval: 300
|
||||||
|
lazy: false
|
||||||
|
|
||||||
|
# default for downloading subscriptions: BOOT (if set), else the nodes of the
|
||||||
|
# saved subscriptions (providers are cached on disk), else direct. FOREIGN goes
|
||||||
|
# before DIRECT: the health check of DIRECT (gstatic) passes in Russia even when
|
||||||
|
# the subscription site itself is blocked.
|
||||||
|
- name: BOOT-AUTO
|
||||||
|
type: fallback
|
||||||
|
proxies: [BOOT, FOREIGN, DIRECT]
|
||||||
|
url: "https://www.gstatic.com/generate_204"
|
||||||
|
interval: 300
|
||||||
|
lazy: false
|
||||||
|
|
||||||
|
- name: RU
|
||||||
|
type: url-test
|
||||||
|
use: [example, example2]
|
||||||
|
filter: "(?i)🇷🇺|\\bru\\b|russia|росси|моск"
|
||||||
|
# lite: the provider's URL, so RU nodes are not tested a second time
|
||||||
|
url: "https://ya.ru"
|
||||||
|
interval: 300
|
||||||
|
tolerance: 50
|
||||||
|
lazy: false
|
||||||
|
|
||||||
|
- name: FOREIGN
|
||||||
|
type: url-test
|
||||||
|
use: [example, example2]
|
||||||
|
exclude-filter: "(?i)🇷🇺|\\bru\\b|russia|росси|моск"
|
||||||
|
url: "https://www.gstatic.com/generate_204"
|
||||||
|
interval: 300
|
||||||
|
tolerance: 50
|
||||||
|
lazy: false
|
||||||
|
|
||||||
|
- name: TORRENT
|
||||||
|
type: url-test
|
||||||
|
use: [example, example2]
|
||||||
|
filter: "(?i)torrent|\\[tor\\]"
|
||||||
|
url: "https://www.gstatic.com/generate_204"
|
||||||
|
interval: 300
|
||||||
|
timeout: 6000
|
||||||
|
tolerance: 500
|
||||||
|
max-failed-times: 5
|
||||||
|
lazy: false
|
||||||
|
|
||||||
|
# pool de (POOLS, POOL_*): own servers and subscription nodes picked in the settings;
|
||||||
|
# filter / exclude-filter apply to the subscriptions' nodes only
|
||||||
|
- name: DE
|
||||||
|
type: fallback
|
||||||
|
use: [example]
|
||||||
|
url: "https://www.gstatic.com/generate_204"
|
||||||
|
interval: 300
|
||||||
|
lazy: false
|
||||||
|
|
||||||
|
# pool mix (POOLS, POOL_*): own servers and subscription nodes picked in the settings;
|
||||||
|
# filter / exclude-filter apply to the subscriptions' nodes only
|
||||||
|
- name: MIX
|
||||||
|
type: fallback
|
||||||
|
use: [example-my, example-my-via-FOREIGN]
|
||||||
|
url: "https://www.gstatic.com/generate_204"
|
||||||
|
interval: 300
|
||||||
|
lazy: false
|
||||||
|
|
||||||
|
# pool svc-fixed-claude (POOLS, POOL_*): own servers and subscription nodes picked in the settings;
|
||||||
|
# filter / exclude-filter apply to the subscriptions' nodes only
|
||||||
|
- name: SVC-FIXED-CLAUDE
|
||||||
|
type: select
|
||||||
|
empty-fallback: REJECT
|
||||||
|
use: [example-my, example-my-via-FOREIGN]
|
||||||
|
filter: "^\\[MY\\] nl\\.2$"
|
||||||
|
|
||||||
|
# own servers: those of the settings (proxies/30-own_srv) and the "[MY] ..." nodes of
|
||||||
|
# the subscriptions (providers <id>-my); the fastest alive one; pin one in the dashboard if needed
|
||||||
|
- name: MY
|
||||||
|
type: url-test
|
||||||
|
use: [example-my, example-my-via-FOREIGN, example2-my, example2-my-via-DE]
|
||||||
|
url: "https://www.gstatic.com/generate_204"
|
||||||
|
interval: 300
|
||||||
|
tolerance: 50
|
||||||
|
lazy: false
|
||||||
|
|
||||||
|
# whitelist and mobile (my_exit): what own servers are reached through; switches only when the node is
|
||||||
|
# clearly worse or dead (each switch breaks everything going through MY)
|
||||||
|
- name: MY-EXIT
|
||||||
|
type: url-test
|
||||||
|
use: [example, example2]
|
||||||
|
exclude-filter: "(?i)🇷🇺|\\bru\\b|russia|росси|моск"
|
||||||
|
url: "https://www.gstatic.com/generate_204"
|
||||||
|
interval: 300
|
||||||
|
tolerance: 300
|
||||||
|
lazy: false
|
||||||
|
|
||||||
|
# service claude (SERVICES, SVC_*): its own way, whatever MAIN is
|
||||||
|
- name: CLAUDE
|
||||||
|
type: select
|
||||||
|
proxies: ["SVC-FIXED-CLAUDE ⟶ RU"]
|
||||||
|
|
||||||
|
# SVC-FIXED-CLAUDE through RU (SVC_<NAME>_CHAIN, POOL_<NAME>_UPLINK): its servers and
|
||||||
|
# nodes, each dialing through RU
|
||||||
|
- name: "SVC-FIXED-CLAUDE ⟶ RU"
|
||||||
|
type: select
|
||||||
|
empty-fallback: REJECT
|
||||||
|
use: [example-my@RU]
|
||||||
|
filter: "^\\[MY\\] nl\\.2 ⟶ RU$"
|
||||||
|
|
||||||
|
- name: MAIN
|
||||||
|
type: select
|
||||||
|
proxies: [FOREIGN, MY, RU, DIRECT]
|
||||||
|
|
||||||
|
- name: TORRENT-SEL
|
||||||
|
type: select
|
||||||
|
proxies: [TORRENT, FOREIGN, DIRECT]
|
||||||
|
|
||||||
|
- name: PUSH
|
||||||
|
type: select
|
||||||
|
# no own servers in the settings: MY may be empty (no [MY] nodes in the subscriptions)
|
||||||
|
proxies: [FOREIGN, MY, DIRECT]
|
||||||
|
|
||||||
|
rules:
|
||||||
|
- IP-CIDR,192.168.0.0/16,DIRECT,no-resolve
|
||||||
|
- IP-CIDR,10.0.0.0/8,DIRECT,no-resolve
|
||||||
|
- IP-CIDR,172.16.0.0/12,DIRECT,no-resolve
|
||||||
|
|
||||||
|
# push notifications (Apple APNs, Google FCM): long-lived connections on a
|
||||||
|
# stable path - group PUSH (main/foreign: DIRECT, whitelist: MY)
|
||||||
|
- DOMAIN-SUFFIX,push.apple.com,PUSH
|
||||||
|
- IP-CIDR,17.249.0.0/16,PUSH,no-resolve
|
||||||
|
- IP-CIDR,17.252.0.0/16,PUSH,no-resolve
|
||||||
|
- IP-CIDR,17.57.144.0/22,PUSH,no-resolve
|
||||||
|
- IP-CIDR,17.188.128.0/18,PUSH,no-resolve
|
||||||
|
- IP-CIDR,17.188.20.0/23,PUSH,no-resolve
|
||||||
|
- DOMAIN-REGEX,^(alt[0-9]+-)?mtalk[0-9]*\.google\.com$,PUSH
|
||||||
|
- DST-PORT,5228-5230,PUSH
|
||||||
|
|
||||||
|
# service claude: above the own lists, below the tunnels, LAN and push
|
||||||
|
- DOMAIN-SUFFIX,claude.ai,CLAUDE
|
||||||
|
|
||||||
|
# own lists from the settings: above torrents, ru-inside, .ru and MATCH; below the
|
||||||
|
# tunnels, LAN and push. Domains (DOMAIN-SUFFIX: the domain and all subdomains)
|
||||||
|
# before IPs; first match wins: MY, then FOREIGN, then RU.
|
||||||
|
# RU on main (home, own white IP): reachable directly; whitelist/abroad: through RU
|
||||||
|
- IP-CIDR,194.190.191.112/32,RU
|
||||||
|
|
||||||
|
- SRC-PORT,20000-20199,TORRENT-SEL
|
||||||
|
|
||||||
|
- RULE-SET,ru-inside,DIRECT
|
||||||
|
# main (home, own white IP): ru-services and .ru/.su/.рф directly; elsewhere through RU
|
||||||
|
- RULE-SET,ru-services,RU
|
||||||
|
- DOMAIN-SUFFIX,ru,RU
|
||||||
|
- DOMAIN-SUFFIX,su,RU
|
||||||
|
- DOMAIN-SUFFIX,xn--p1ai,RU
|
||||||
|
- MATCH,MAIN
|
||||||
@ -32,11 +32,13 @@ proxies:
|
|||||||
|
|
||||||
# own servers of the settings (LuCI "Свои серверы", /etc/nikki/my-servers): one JSON
|
# own servers of the settings (LuCI "Свои серверы", /etc/nikki/my-servers): one JSON
|
||||||
# proxy per line, as mihomo's own config would have it; the kit puts dialer-proxy in
|
# proxy per line, as mihomo's own config would have it; the kit puts dialer-proxy in
|
||||||
# front: whitelist and the phone through MY-EXIT, else with UPLINK (CSQTT, pools) through it
|
# front: whitelist and the phone through MY-EXIT, else with UPLINK (CSQTT, pools) through it.
|
||||||
|
# A server with an entry of its own (LuCI "Вход") keeps it in every profile
|
||||||
- {"dialer-proxy": "MY-EXIT", "name":"🇩🇪 de 1","type":"vless","server":"x.example.com","port":"443","uuid":"00000000-0000-0000-0000-000000000001","udp":true,"tls":true,"client-fingerprint":"chrome","servername":"www.example.com","reality-opts":{"public-key":"Nc9ZSDuQMwHN4M6TeDHjfJhgZ6SBTBbfMwx5iHQZ1ns","short-id":"ab"},"xudp":true,"network":"xhttp","xhttp-opts":{"path":"/x"}}
|
- {"dialer-proxy": "MY-EXIT", "name":"🇩🇪 de 1","type":"vless","server":"x.example.com","port":"443","uuid":"00000000-0000-0000-0000-000000000001","udp":true,"tls":true,"client-fingerprint":"chrome","servername":"www.example.com","reality-opts":{"public-key":"Nc9ZSDuQMwHN4M6TeDHjfJhgZ6SBTBbfMwx5iHQZ1ns","short-id":"ab"},"xudp":true,"network":"xhttp","xhttp-opts":{"path":"/x"}}
|
||||||
- {"dialer-proxy": "MY-EXIT", "name":"tr \"q\"","type":"trojan","server":"t.example.org","port":"443","password":"p\u0024w","udp":true,"skip-cert-verify":false,"sni":"t.example.org","network":"grpc","grpc-opts":{"grpc-service-name":"g"},"client-fingerprint":"chrome"}
|
- {"dialer-proxy": "MY-EXIT", "name":"tr \"q\"","type":"trojan","server":"t.example.org","port":"443","password":"p\u0024w","udp":true,"skip-cert-verify":false,"sni":"t.example.org","network":"grpc","grpc-opts":{"grpc-service-name":"g"},"client-fingerprint":"chrome"}
|
||||||
- {"dialer-proxy": "MY-EXIT", "name":"hy-own","type":"hysteria2","server":"h.example.net","port":8443,"password":"a\u0024b","obfs":"salamander","obfs-password":"o","up":"50 mbps"}
|
- {"dialer-proxy": "MY-EXIT", "name":"hy-own","type":"hysteria2","server":"h.example.net","port":8443,"password":"a\u0024b","obfs":"salamander","obfs-password":"o","up":"50 mbps"}
|
||||||
- {"dialer-proxy": "MY-EXIT", "name":"awg-own","type":"wireguard","server":"203.0.113.10","port":47613,"ip":"10.8.1.2","private-key":"fTo2df+b5vCuulh7pOXMWiWJY2VwSe2Kuup2nA34tfI=","public-key":"vGYpG72gCXPNfYzr/0iNfSoL83vbrVSGUC+v+MKRVyE=","pre-shared-key":"6ut/J6EuaJ97RMFcZuiJkzIo7a5uxR98htK5NdWJW6E=","persistent-keepalive":25,"udp":true,"amnezia-wg-option":{"jc":4,"jmin":10,"jmax":50,"s1":98,"s2":32,"s3":19,"s4":7,"h1":"1458367412-1593426716","h2":"1863071624-1902347825","h3":"2091548318-2097143921","h4":"2112573893-2147191025","i1":"<r 2><b 0x858000010001000000000669636c6f756403636f6d0000010001c00c000100010000105a00044d583737>"}}
|
- {"dialer-proxy": "MY-EXIT", "name":"awg-own","type":"wireguard","server":"203.0.113.10","port":47613,"ip":"10.8.1.2","private-key":"fTo2df+b5vCuulh7pOXMWiWJY2VwSe2Kuup2nA34tfI=","public-key":"vGYpG72gCXPNfYzr/0iNfSoL83vbrVSGUC+v+MKRVyE=","pre-shared-key":"6ut/J6EuaJ97RMFcZuiJkzIo7a5uxR98htK5NdWJW6E=","persistent-keepalive":25,"udp":true,"amnezia-wg-option":{"jc":4,"jmin":10,"jmax":50,"s1":98,"s2":32,"s3":19,"s4":7,"h1":"1458367412-1593426716","h2":"1863071624-1902347825","h3":"2091548318-2097143921","h4":"2112573893-2147191025","i1":"<r 2><b 0x858000010001000000000669636c6f756403636f6d0000010001c00c000100010000105a00044d583737>"}}
|
||||||
|
- {"name":"via-foreign","type":"ss","server":"f.example.com","port":8388,"cipher":"aes-256-gcm","password":"x","dialer-proxy":"FOREIGN"}
|
||||||
|
|
||||||
# copies of own servers for the chains (SVC_<NAME>_CHAIN, POOL_<NAME>_UPLINK): the same
|
# copies of own servers for the chains (SVC_<NAME>_CHAIN, POOL_<NAME>_UPLINK): the same
|
||||||
# server dialing through another entry, named "<server> ⟶ <entry>" (group "<pool> ⟶ <entry>")
|
# server dialing through another entry, named "<server> ⟶ <entry>" (group "<pool> ⟶ <entry>")
|
||||||
@ -46,6 +48,7 @@ proxies:
|
|||||||
- {"dialer-proxy": "FOREIGN", "name":"tr \"q\" ⟶ FOREIGN","type":"trojan","server":"t.example.org","port":"443","password":"p\u0024w","udp":true,"skip-cert-verify":false,"sni":"t.example.org","network":"grpc","grpc-opts":{"grpc-service-name":"g"},"client-fingerprint":"chrome"}
|
- {"dialer-proxy": "FOREIGN", "name":"tr \"q\" ⟶ FOREIGN","type":"trojan","server":"t.example.org","port":"443","password":"p\u0024w","udp":true,"skip-cert-verify":false,"sni":"t.example.org","network":"grpc","grpc-opts":{"grpc-service-name":"g"},"client-fingerprint":"chrome"}
|
||||||
- {"dialer-proxy": "FOREIGN", "name":"hy-own ⟶ FOREIGN","type":"hysteria2","server":"h.example.net","port":8443,"password":"a\u0024b","obfs":"salamander","obfs-password":"o","up":"50 mbps"}
|
- {"dialer-proxy": "FOREIGN", "name":"hy-own ⟶ FOREIGN","type":"hysteria2","server":"h.example.net","port":8443,"password":"a\u0024b","obfs":"salamander","obfs-password":"o","up":"50 mbps"}
|
||||||
- {"dialer-proxy": "FOREIGN", "name":"awg-own ⟶ FOREIGN","type":"wireguard","server":"203.0.113.10","port":47613,"ip":"10.8.1.2","private-key":"fTo2df+b5vCuulh7pOXMWiWJY2VwSe2Kuup2nA34tfI=","public-key":"vGYpG72gCXPNfYzr/0iNfSoL83vbrVSGUC+v+MKRVyE=","pre-shared-key":"6ut/J6EuaJ97RMFcZuiJkzIo7a5uxR98htK5NdWJW6E=","persistent-keepalive":25,"udp":true,"amnezia-wg-option":{"jc":4,"jmin":10,"jmax":50,"s1":98,"s2":32,"s3":19,"s4":7,"h1":"1458367412-1593426716","h2":"1863071624-1902347825","h3":"2091548318-2097143921","h4":"2112573893-2147191025","i1":"<r 2><b 0x858000010001000000000669636c6f756403636f6d0000010001c00c000100010000105a00044d583737>"}}
|
- {"dialer-proxy": "FOREIGN", "name":"awg-own ⟶ FOREIGN","type":"wireguard","server":"203.0.113.10","port":47613,"ip":"10.8.1.2","private-key":"fTo2df+b5vCuulh7pOXMWiWJY2VwSe2Kuup2nA34tfI=","public-key":"vGYpG72gCXPNfYzr/0iNfSoL83vbrVSGUC+v+MKRVyE=","pre-shared-key":"6ut/J6EuaJ97RMFcZuiJkzIo7a5uxR98htK5NdWJW6E=","persistent-keepalive":25,"udp":true,"amnezia-wg-option":{"jc":4,"jmin":10,"jmax":50,"s1":98,"s2":32,"s3":19,"s4":7,"h1":"1458367412-1593426716","h2":"1863071624-1902347825","h3":"2091548318-2097143921","h4":"2112573893-2147191025","i1":"<r 2><b 0x858000010001000000000669636c6f756403636f6d0000010001c00c000100010000105a00044d583737>"}}
|
||||||
|
- {"dialer-proxy": "FOREIGN", "name":"via-foreign ⟶ FOREIGN","type":"ss","server":"f.example.com","port":8388,"cipher":"aes-256-gcm","password":"x"}
|
||||||
|
|
||||||
proxy-providers:
|
proxy-providers:
|
||||||
example:
|
example:
|
||||||
@ -95,7 +98,8 @@ proxy-providers:
|
|||||||
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
||||||
# main provider saves (mihomo watches it; ./providers exists before the start,
|
# main provider saves (mihomo watches it; ./providers exists before the start,
|
||||||
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
||||||
# so the subscription is fetched once more.
|
# so the subscription is fetched once more. Nodes with an entry of their own
|
||||||
|
# (MY_NODE_ENTRIES) are left out here for <id>-my-via-<entry> (providers/16-myvia).
|
||||||
example-my:
|
example-my:
|
||||||
type: file
|
type: file
|
||||||
path: ./providers/example.yaml
|
path: ./providers/example.yaml
|
||||||
@ -114,7 +118,8 @@ proxy-providers:
|
|||||||
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
||||||
# main provider saves (mihomo watches it; ./providers exists before the start,
|
# main provider saves (mihomo watches it; ./providers exists before the start,
|
||||||
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
||||||
# so the subscription is fetched once more.
|
# so the subscription is fetched once more. Nodes with an entry of their own
|
||||||
|
# (MY_NODE_ENTRIES) are left out here for <id>-my-via-<entry> (providers/16-myvia).
|
||||||
example2-my:
|
example2-my:
|
||||||
type: file
|
type: file
|
||||||
path: ./providers/example2.yaml
|
path: ./providers/example2.yaml
|
||||||
@ -271,6 +276,20 @@ rule-providers:
|
|||||||
path: ./ruleset/geosite-openai.mrs
|
path: ./ruleset/geosite-openai.mrs
|
||||||
interval: 86400
|
interval: 86400
|
||||||
|
|
||||||
|
# service yt: domains of its hostlists (SVC_<NAME>_HOSTLIST, e.g. zapret's
|
||||||
|
# /opt/zapret2/ipset/*.txt), read when the profile is built: rebuild to pick up changes
|
||||||
|
hostlist-yt:
|
||||||
|
type: inline
|
||||||
|
behavior: domain
|
||||||
|
payload:
|
||||||
|
- "+.youtube.com"
|
||||||
|
- "+.youtu.be"
|
||||||
|
- "+.googlevideo.com"
|
||||||
|
- "exact.example"
|
||||||
|
- "+.wild.example"
|
||||||
|
- "+.dot.example"
|
||||||
|
- "+.ggpht.com"
|
||||||
|
|
||||||
sniffer:
|
sniffer:
|
||||||
enable: true
|
enable: true
|
||||||
force-dns-mapping: true
|
force-dns-mapping: true
|
||||||
@ -407,7 +426,7 @@ proxy-groups:
|
|||||||
# the subscriptions (providers <id>-my); the fastest alive one; pin one in the dashboard if needed
|
# the subscriptions (providers <id>-my); the fastest alive one; pin one in the dashboard if needed
|
||||||
- name: MY
|
- name: MY
|
||||||
type: url-test
|
type: url-test
|
||||||
proxies: ["🇩🇪 de 1", "tr \"q\"", "hy-own", "awg-own"]
|
proxies: ["🇩🇪 de 1", "tr \"q\"", "hy-own", "awg-own", "via-foreign"]
|
||||||
use: [example-my, example2-my, my-links]
|
use: [example-my, example2-my, my-links]
|
||||||
url: "https://www.gstatic.com/generate_204"
|
url: "https://www.gstatic.com/generate_204"
|
||||||
interval: 300
|
interval: 300
|
||||||
@ -435,6 +454,11 @@ proxy-groups:
|
|||||||
type: select
|
type: select
|
||||||
proxies: ["MY ⟶ FOREIGN", MY, FOREIGN, RU, DIRECT]
|
proxies: ["MY ⟶ FOREIGN", MY, FOREIGN, RU, DIRECT]
|
||||||
|
|
||||||
|
# service yt (SERVICES, SVC_*): its own way, whatever MAIN is
|
||||||
|
- name: YT
|
||||||
|
type: select
|
||||||
|
proxies: [RU, MY, FOREIGN, DIRECT]
|
||||||
|
|
||||||
# WL through DIRECT (SVC_<NAME>_CHAIN, POOL_<NAME>_UPLINK): its servers and
|
# WL through DIRECT (SVC_<NAME>_CHAIN, POOL_<NAME>_UPLINK): its servers and
|
||||||
# nodes, each dialing through DIRECT
|
# nodes, each dialing through DIRECT
|
||||||
- name: "WL ⟶ DIRECT"
|
- name: "WL ⟶ DIRECT"
|
||||||
@ -462,7 +486,7 @@ proxy-groups:
|
|||||||
# nodes, each dialing through FOREIGN
|
# nodes, each dialing through FOREIGN
|
||||||
- name: "MY ⟶ FOREIGN"
|
- name: "MY ⟶ FOREIGN"
|
||||||
type: fallback
|
type: fallback
|
||||||
proxies: ["🇩🇪 de 1 ⟶ FOREIGN", "tr \"q\" ⟶ FOREIGN", "hy-own ⟶ FOREIGN", "awg-own ⟶ FOREIGN"]
|
proxies: ["🇩🇪 de 1 ⟶ FOREIGN", "tr \"q\" ⟶ FOREIGN", "hy-own ⟶ FOREIGN", "awg-own ⟶ FOREIGN", "via-foreign ⟶ FOREIGN"]
|
||||||
use: [example-my@FOREIGN, example2-my@FOREIGN, my-links@FOREIGN]
|
use: [example-my@FOREIGN, example2-my@FOREIGN, my-links@FOREIGN]
|
||||||
url: "https://www.gstatic.com/generate_204"
|
url: "https://www.gstatic.com/generate_204"
|
||||||
interval: 300
|
interval: 300
|
||||||
@ -525,6 +549,9 @@ rules:
|
|||||||
- RULE-SET,geosite-anthropic,CHAT
|
- RULE-SET,geosite-anthropic,CHAT
|
||||||
- IP-CIDR,1.2.3.4/32,CHAT
|
- IP-CIDR,1.2.3.4/32,CHAT
|
||||||
|
|
||||||
|
# service yt: above the own lists, below the tunnels, LAN and push
|
||||||
|
- RULE-SET,hostlist-yt,YT
|
||||||
|
|
||||||
# own lists from the settings: above torrents, ru-inside, .ru and MATCH; below the
|
# own lists from the settings: above torrents, ru-inside, .ru and MATCH; below the
|
||||||
# tunnels, LAN and push. Domains (DOMAIN-SUFFIX: the domain and all subdomains)
|
# tunnels, LAN and push. Domains (DOMAIN-SUFFIX: the domain and all subdomains)
|
||||||
# before IPs; first match wins: MY, then FOREIGN, then RU.
|
# before IPs; first match wins: MY, then FOREIGN, then RU.
|
||||||
|
|||||||
@ -31,7 +31,8 @@ proxies:
|
|||||||
|
|
||||||
# own servers of the settings (LuCI "Свои серверы", /etc/nikki/my-servers): one JSON
|
# own servers of the settings (LuCI "Свои серверы", /etc/nikki/my-servers): one JSON
|
||||||
# proxy per line, as mihomo's own config would have it; the kit puts dialer-proxy in
|
# proxy per line, as mihomo's own config would have it; the kit puts dialer-proxy in
|
||||||
# front: whitelist and the phone through MY-EXIT, else with UPLINK (CSQTT, pools) through it
|
# front: whitelist and the phone through MY-EXIT, else with UPLINK (CSQTT, pools) through it.
|
||||||
|
# A server with an entry of its own (LuCI "Вход") keeps it in every profile
|
||||||
- {"dialer-proxy": "MY-EXIT", "name":"nl-1","type":"hysteria2","server":"vpn.example.com","port":443,"password":"p","udp":true}
|
- {"dialer-proxy": "MY-EXIT", "name":"nl-1","type":"hysteria2","server":"vpn.example.com","port":443,"password":"p","udp":true}
|
||||||
- {"dialer-proxy": "MY-EXIT", "name":"de-2","type":"hysteria2","server":"5.6.7.8","port":443,"password":"q","udp":true}
|
- {"dialer-proxy": "MY-EXIT", "name":"de-2","type":"hysteria2","server":"5.6.7.8","port":443,"password":"q","udp":true}
|
||||||
|
|
||||||
@ -79,7 +80,8 @@ proxy-providers:
|
|||||||
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
||||||
# main provider saves (mihomo watches it; ./providers exists before the start,
|
# main provider saves (mihomo watches it; ./providers exists before the start,
|
||||||
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
||||||
# so the subscription is fetched once more.
|
# so the subscription is fetched once more. Nodes with an entry of their own
|
||||||
|
# (MY_NODE_ENTRIES) are left out here for <id>-my-via-<entry> (providers/16-myvia).
|
||||||
example-my:
|
example-my:
|
||||||
type: file
|
type: file
|
||||||
path: ./providers/example.yaml
|
path: ./providers/example.yaml
|
||||||
@ -98,7 +100,8 @@ proxy-providers:
|
|||||||
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
||||||
# main provider saves (mihomo watches it; ./providers exists before the start,
|
# main provider saves (mihomo watches it; ./providers exists before the start,
|
||||||
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
||||||
# so the subscription is fetched once more.
|
# so the subscription is fetched once more. Nodes with an entry of their own
|
||||||
|
# (MY_NODE_ENTRIES) are left out here for <id>-my-via-<entry> (providers/16-myvia).
|
||||||
example2-my:
|
example2-my:
|
||||||
type: file
|
type: file
|
||||||
path: ./providers/example2.yaml
|
path: ./providers/example2.yaml
|
||||||
|
|||||||
@ -28,7 +28,8 @@ proxies:
|
|||||||
|
|
||||||
# own servers of the settings (LuCI "Свои серверы", /etc/nikki/my-servers): one JSON
|
# own servers of the settings (LuCI "Свои серверы", /etc/nikki/my-servers): one JSON
|
||||||
# proxy per line, as mihomo's own config would have it; the kit puts dialer-proxy in
|
# proxy per line, as mihomo's own config would have it; the kit puts dialer-proxy in
|
||||||
# front: whitelist and the phone through MY-EXIT, else with UPLINK (CSQTT, pools) through it
|
# front: whitelist and the phone through MY-EXIT, else with UPLINK (CSQTT, pools) through it.
|
||||||
|
# A server with an entry of its own (LuCI "Вход") keeps it in every profile
|
||||||
- {"dialer-proxy": "MY-EXIT", "name":"nl-1","type":"hysteria2","server":"vpn.example.com","port":443,"password":"p\"w\\1","obfs":"salamander","obfs-password":"obfs","sni":"vpn.example.com","up":"50 mbps","down":"100 mbps","udp":true}
|
- {"dialer-proxy": "MY-EXIT", "name":"nl-1","type":"hysteria2","server":"vpn.example.com","port":443,"password":"p\"w\\1","obfs":"salamander","obfs-password":"obfs","sni":"vpn.example.com","up":"50 mbps","down":"100 mbps","udp":true}
|
||||||
- {"dialer-proxy": "MY-EXIT", "name":"de_2","type":"hysteria2","server":"5.6.7.8","port":8443,"password":"x","sni":"www.bing.com","skip-cert-verify":true,"udp":true}
|
- {"dialer-proxy": "MY-EXIT", "name":"de_2","type":"hysteria2","server":"5.6.7.8","port":8443,"password":"x","sni":"www.bing.com","skip-cert-verify":true,"udp":true}
|
||||||
|
|
||||||
@ -76,7 +77,8 @@ proxy-providers:
|
|||||||
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
||||||
# main provider saves (mihomo watches it; ./providers exists before the start,
|
# main provider saves (mihomo watches it; ./providers exists before the start,
|
||||||
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
||||||
# so the subscription is fetched once more.
|
# so the subscription is fetched once more. Nodes with an entry of their own
|
||||||
|
# (MY_NODE_ENTRIES) are left out here for <id>-my-via-<entry> (providers/16-myvia).
|
||||||
example-my:
|
example-my:
|
||||||
type: file
|
type: file
|
||||||
path: ./providers/example.yaml
|
path: ./providers/example.yaml
|
||||||
@ -95,7 +97,8 @@ proxy-providers:
|
|||||||
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
# phone they go through MY-EXIT. Router: not a second download, reads the file the
|
||||||
# main provider saves (mihomo watches it; ./providers exists before the start,
|
# main provider saves (mihomo watches it; ./providers exists before the start,
|
||||||
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
# ovpn_routes_write). Phone: FlClash moves provider files to paths of its own,
|
||||||
# so the subscription is fetched once more.
|
# so the subscription is fetched once more. Nodes with an entry of their own
|
||||||
|
# (MY_NODE_ENTRIES) are left out here for <id>-my-via-<entry> (providers/16-myvia).
|
||||||
example2-my:
|
example2-my:
|
||||||
type: file
|
type: file
|
||||||
path: ./providers/example2.yaml
|
path: ./providers/example2.yaml
|
||||||
|
|||||||
1
tests/fixtures/own.servers
vendored
1
tests/fixtures/own.servers
vendored
@ -2,3 +2,4 @@
|
|||||||
{"name":"tr \"q\"","type":"trojan","server":"t.example.org","port":"443","password":"p\u0024w","udp":true,"skip-cert-verify":false,"sni":"t.example.org","network":"grpc","grpc-opts":{"grpc-service-name":"g"},"client-fingerprint":"chrome"}
|
{"name":"tr \"q\"","type":"trojan","server":"t.example.org","port":"443","password":"p\u0024w","udp":true,"skip-cert-verify":false,"sni":"t.example.org","network":"grpc","grpc-opts":{"grpc-service-name":"g"},"client-fingerprint":"chrome"}
|
||||||
{"name":"hy-own","type":"hysteria2","server":"h.example.net","port":8443,"password":"a\u0024b","obfs":"salamander","obfs-password":"o","up":"50 mbps"}
|
{"name":"hy-own","type":"hysteria2","server":"h.example.net","port":8443,"password":"a\u0024b","obfs":"salamander","obfs-password":"o","up":"50 mbps"}
|
||||||
{"name":"awg-own","type":"wireguard","server":"203.0.113.10","port":47613,"ip":"10.8.1.2","private-key":"fTo2df+b5vCuulh7pOXMWiWJY2VwSe2Kuup2nA34tfI=","public-key":"vGYpG72gCXPNfYzr/0iNfSoL83vbrVSGUC+v+MKRVyE=","pre-shared-key":"6ut/J6EuaJ97RMFcZuiJkzIo7a5uxR98htK5NdWJW6E=","persistent-keepalive":25,"udp":true,"amnezia-wg-option":{"jc":4,"jmin":10,"jmax":50,"s1":98,"s2":32,"s3":19,"s4":7,"h1":"1458367412-1593426716","h2":"1863071624-1902347825","h3":"2091548318-2097143921","h4":"2112573893-2147191025","i1":"<r 2><b 0x858000010001000000000669636c6f756403636f6d0000010001c00c000100010000105a00044d583737>"}}
|
{"name":"awg-own","type":"wireguard","server":"203.0.113.10","port":47613,"ip":"10.8.1.2","private-key":"fTo2df+b5vCuulh7pOXMWiWJY2VwSe2Kuup2nA34tfI=","public-key":"vGYpG72gCXPNfYzr/0iNfSoL83vbrVSGUC+v+MKRVyE=","pre-shared-key":"6ut/J6EuaJ97RMFcZuiJkzIo7a5uxR98htK5NdWJW6E=","persistent-keepalive":25,"udp":true,"amnezia-wg-option":{"jc":4,"jmin":10,"jmax":50,"s1":98,"s2":32,"s3":19,"s4":7,"h1":"1458367412-1593426716","h2":"1863071624-1902347825","h3":"2091548318-2097143921","h4":"2112573893-2147191025","i1":"<r 2><b 0x858000010001000000000669636c6f756403636f6d0000010001c00c000100010000105a00044d583737>"}}
|
||||||
|
{"name":"via-foreign","type":"ss","server":"f.example.com","port":8388,"cipher":"aes-256-gcm","password":"x","dialer-proxy":"FOREIGN"}
|
||||||
|
|||||||
13
tests/fixtures/router-myvia.env
vendored
Normal file
13
tests/fixtures/router-myvia.env
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
LOCATION=whitelist
|
||||||
|
# [MY] nodes with an entry of their own (LuCI: «Свои серверы» → «Вход»)
|
||||||
|
MY_NODE_1='FOREIGN|example-my|[MY] 🇩🇪 de-1 (a)'
|
||||||
|
MY_NODE_2='FOREIGN|example-my|[MY] nl.2'
|
||||||
|
MY_NODE_3='DE|example2-my|[MY] fi`3'
|
||||||
|
POOLS='de mix'
|
||||||
|
POOL_DE_SUBS='example'
|
||||||
|
POOL_MIX_SUBS='example-my'
|
||||||
|
SERVICES='claude'
|
||||||
|
SVC_CLAUDE_DOMAINS='claude.ai'
|
||||||
|
SVC_CLAUDE_SERVER='[MY] nl.2'
|
||||||
|
SVC_CLAUDE_PROVIDER='example-my'
|
||||||
|
SVC_CLAUDE_CHAIN='RU'
|
||||||
4
tests/fixtures/router-whitelist-ts-my.env
vendored
4
tests/fixtures/router-whitelist-ts-my.env
vendored
@ -3,7 +3,7 @@ LOCATION=whitelist
|
|||||||
TAILSCALE=1
|
TAILSCALE=1
|
||||||
MY_LINKS='vless://00000000-0000-0000-0000-000000000001@x.example.com:443?security=reality&sni=www.example.com&pbk=Nc9ZSDuQMwHN4M6TeDHjfJhgZ6SBTBbfMwx5iHQZ1ns&sid=ab&type=xhttp&path=%2Fx#de%201 trojan://pw@t.example.org:443?sni=t.example.org#tr'
|
MY_LINKS='vless://00000000-0000-0000-0000-000000000001@x.example.com:443?security=reality&sni=www.example.com&pbk=Nc9ZSDuQMwHN4M6TeDHjfJhgZ6SBTBbfMwx5iHQZ1ns&sid=ab&type=xhttp&path=%2Fx#de%201 trojan://pw@t.example.org:443?sni=t.example.org#tr'
|
||||||
MY_SERVERS_FILE=tests/fixtures/own.servers
|
MY_SERVERS_FILE=tests/fixtures/own.servers
|
||||||
SERVICES="claude chat"
|
SERVICES="claude chat yt"
|
||||||
SVC_CLAUDE_GEOSITE=anthropic
|
SVC_CLAUDE_GEOSITE=anthropic
|
||||||
SVC_CLAUDE_VIA=DE
|
SVC_CLAUDE_VIA=DE
|
||||||
SVC_CLAUDE_CHAIN=WL
|
SVC_CLAUDE_CHAIN=WL
|
||||||
@ -12,6 +12,8 @@ SVC_CHAT_GEOSITE="openai anthropic"
|
|||||||
SVC_CHAT_IPS="1.2.3.4"
|
SVC_CHAT_IPS="1.2.3.4"
|
||||||
SVC_CHAT_VIA=MY
|
SVC_CHAT_VIA=MY
|
||||||
SVC_CHAT_CHAIN=FOREIGN
|
SVC_CHAT_CHAIN=FOREIGN
|
||||||
|
SVC_YT_HOSTLIST="tests/hostlists/youtube.txt tests/hostlists/extra.txt.gz tests/hostlists/missing.txt"
|
||||||
|
SVC_YT_VIA=RU
|
||||||
POOLS="de gone wl"
|
POOLS="de gone wl"
|
||||||
POOL_DE_TYPE=url-test
|
POOL_DE_TYPE=url-test
|
||||||
POOL_DE_SERVERS='🇩🇪 de 1; hy-own; renamed-server'
|
POOL_DE_SERVERS='🇩🇪 de 1; hy-own; renamed-server'
|
||||||
|
|||||||
BIN
tests/hostlists/extra.txt.gz
Normal file
BIN
tests/hostlists/extra.txt.gz
Normal file
Binary file not shown.
11
tests/hostlists/youtube.txt
Normal file
11
tests/hostlists/youtube.txt
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# zapret hostlist
|
||||||
|
youtube.com
|
||||||
|
YouTu.be
|
||||||
|
googlevideo.com # video
|
||||||
|
|
||||||
|
^exact.example
|
||||||
|
*.wild.example
|
||||||
|
.dot.example
|
||||||
|
youtube.com
|
||||||
|
bad domain!
|
||||||
|
1.2.3.4
|
||||||
103
tools/nikki-mirror.sh
Executable file
103
tools/nikki-mirror.sh
Executable file
@ -0,0 +1,103 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Mirror an OpenWrt-nikki release into the kit repo's releases: the router installs
|
||||||
|
# nikki from there (router/mihomo-kit.sh nikki_feed), GitHub is often unreachable.
|
||||||
|
# GITEA_TOKEN=... tools/nikki-mirror.sh [v1.26.2|latest] [arch...]
|
||||||
|
# Each nikki_<arch>-openwrt-24.10.tar.gz is a signed opkg feed; it is repacked without
|
||||||
|
# mihomo-alpha and the zh translations (less RAM on the router, Packages and its
|
||||||
|
# signature unchanged) and uploaded to the release nikki-<version>, made if missing.
|
||||||
|
# No arch = all of the release. Assets already there are skipped.
|
||||||
|
# Then set NIKKI_VERSION in router/mihomo-kit.sh and push the kit.
|
||||||
|
# Needs curl, jq, tar, gzip.
|
||||||
|
set -eu
|
||||||
|
ver=${1:-latest}
|
||||||
|
[ $# -gt 0 ] && shift
|
||||||
|
: "${GITEA_TOKEN:?set GITEA_TOKEN (Settings -> Applications, scope write:repository)}"
|
||||||
|
GITEA=${GITEA:-https://git.sam-hub.net}
|
||||||
|
REPO=${REPO:-sam/mihomo-kit}
|
||||||
|
UPSTREAM=nikkinikki-org/OpenWrt-nikki
|
||||||
|
BRANCH=openwrt-24.10
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
work=$(pwd)/nikki-work
|
||||||
|
rm -rf "$work"
|
||||||
|
mkdir -p "$work"
|
||||||
|
trap 'rm -rf "$work"' EXIT
|
||||||
|
|
||||||
|
if [ "$ver" = latest ]; then
|
||||||
|
api=https://api.github.com/repos/$UPSTREAM/releases/latest
|
||||||
|
else
|
||||||
|
api=https://api.github.com/repos/$UPSTREAM/releases/tags/$ver
|
||||||
|
fi
|
||||||
|
curl -fsSL "$api" > "$work/upstream.json"
|
||||||
|
ver=$(jq -r .tag_name "$work/upstream.json")
|
||||||
|
tag=nikki-$ver
|
||||||
|
echo "upstream $ver -> $GITEA/$REPO release $tag"
|
||||||
|
|
||||||
|
# the token through a config file, not argv (ps); timeouts: an upload may stall
|
||||||
|
umask 077
|
||||||
|
printf 'header = "Authorization: token %s"\n' "$GITEA_TOKEN" > "$work/curlrc"
|
||||||
|
gitea() { curl -K "$work/curlrc" -fsS --connect-timeout 20 "$@"; }
|
||||||
|
api=$GITEA/api/v1/repos/$REPO
|
||||||
|
|
||||||
|
if ! gitea -m 60 "$api/releases/tags/$tag" > "$work/release.json" 2>/dev/null; then
|
||||||
|
jq -n --arg t "$tag" --arg v "$ver" '{tag_name: $t, name: $t, target_commitish: "main",
|
||||||
|
body: ("Зеркало https://github.com/nikkinikki-org/OpenWrt-nikki/releases/tag/" + $v +
|
||||||
|
" для установки nikki на роутер (без mihomo-alpha и переводов zh).")}' |
|
||||||
|
gitea -m 60 -X POST -H 'Content-Type: application/json' -d @- \
|
||||||
|
"$api/releases" > "$work/release.json"
|
||||||
|
echo "created release $tag"
|
||||||
|
fi
|
||||||
|
id=$(jq -r .id "$work/release.json")
|
||||||
|
have=$(jq -r '.assets[]?.name' "$work/release.json")
|
||||||
|
|
||||||
|
jq -r --arg b "$BRANCH" '.assets[] | select(.name | endswith("-" + $b + ".tar.gz")) |
|
||||||
|
"\(.name) \(.browser_download_url)"' "$work/upstream.json" > "$work/list"
|
||||||
|
if [ $# -gt 0 ]; then
|
||||||
|
for a in "$@"; do grep "^nikki_$a-$BRANCH.tar.gz " "$work/list" || echo "warning: no bundle for $a" >&2; done \
|
||||||
|
> "$work/list.sel"
|
||||||
|
mv "$work/list.sel" "$work/list"
|
||||||
|
fi
|
||||||
|
[ -s "$work/list" ] || { echo "nothing to mirror" >&2; exit 1; }
|
||||||
|
|
||||||
|
while read -r name url; do
|
||||||
|
if printf '%s\n' "$have" | grep -qx "$name"; then
|
||||||
|
echo "$name: already there"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
echo "$name: downloading"
|
||||||
|
d=$work/b
|
||||||
|
rm -rf "$d"
|
||||||
|
mkdir -p "$d"
|
||||||
|
curl -fSL --connect-timeout 20 -m 600 --retry 3 --progress-bar "$url" | tar xzf - -C "$d"
|
||||||
|
[ -f "$d/Packages.gz" ] && [ -f "$d/Packages.sig" ] || { echo "$name: not a feed" >&2; exit 1; }
|
||||||
|
rm -f "$d"/mihomo-alpha_*.ipk "$d"/luci-i18n-nikki-zh-*.ipk
|
||||||
|
# ustar, no owner names: busybox tar on the router
|
||||||
|
(cd "$d" && tar --format ustar --owner 0 --group 0 -cf - .) | gzip -9 > "$work/$name"
|
||||||
|
size=$(wc -c < "$work/$name")
|
||||||
|
ok=
|
||||||
|
for try in 1 2 3; do
|
||||||
|
echo "$name: uploading $(du -h "$work/$name" | cut -f1) (try $try)"
|
||||||
|
# progress bar on the terminal, then the average speed
|
||||||
|
curl -K "$work/curlrc" -fS --connect-timeout 20 -m 600 --progress-bar -o /dev/null \
|
||||||
|
-w '%{time_total} %{speed_upload}\n' \
|
||||||
|
-X POST -F "attachment=@$work/$name" "$api/releases/$id/assets?name=$name" |
|
||||||
|
awk -v n="$name" '{printf "%s: sent in %ds, %.2f MB/s\n", n, $1, $2 / 1048576}' || true
|
||||||
|
# what the server has now: right size = done, anything else = remove and retry
|
||||||
|
gitea -m 60 "$api/releases/$id/assets" > "$work/assets.json" || continue
|
||||||
|
jq -r --arg n "$name" --argjson s "$size" '.[] | select(.name == $n) |
|
||||||
|
"\(.id) \(if .size == $s then "ok" else "bad" end)"' "$work/assets.json" > "$work/same"
|
||||||
|
if grep -q ' ok$' "$work/same"; then
|
||||||
|
# a stalled try may have landed too: keep one copy
|
||||||
|
grep ' ok$' "$work/same" | tail -n +2 | while read -r a _; do
|
||||||
|
gitea -m 60 -X DELETE "$api/releases/$id/assets/$a"; done
|
||||||
|
ok=1
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
while read -r a _; do gitea -m 60 -X DELETE "$api/releases/$id/assets/$a"; done < "$work/same"
|
||||||
|
done
|
||||||
|
rm -f "$work/$name"
|
||||||
|
[ -n "$ok" ] || { echo "$name: upload failed 3 times, run again later" >&2; exit 1; }
|
||||||
|
done < "$work/list"
|
||||||
|
|
||||||
|
echo "done: $GITEA/$REPO/releases/tag/$tag"
|
||||||
|
grep -q "^NIKKI_VERSION=$ver\$" ../router/mihomo-kit.sh ||
|
||||||
|
echo "now set NIKKI_VERSION=$ver in router/mihomo-kit.sh and push the kit"
|
||||||
@ -44,9 +44,9 @@ for (const f of fs.readdirSync(path.join(root, "amnezia"))) {
|
|||||||
check("amnezia/" + f, JSON.parse(fs.readFileSync(exp, "utf8")),
|
check("amnezia/" + f, JSON.parse(fs.readFileSync(exp, "utf8")),
|
||||||
s.parseText(fs.readFileSync(path.join(root, "amnezia", f), "utf8"), f.replace(/\.[^.]+$/, "")));
|
s.parseText(fs.readFileSync(path.join(root, "amnezia", f), "utf8"), f.replace(/\.[^.]+$/, "")));
|
||||||
}
|
}
|
||||||
// a stored line reads back the same, without dialer-proxy, with no "$" left
|
// a stored line reads back the same (dialer-proxy: the server's own entry), with no "$" left
|
||||||
const p = { name: "a$b", type: "ss", server: "h", port: 1, password: "x${Y}", "dialer-proxy": "Z" };
|
const p = { name: "a$b", type: "ss", server: "h", port: 1, password: "x${Y}", "dialer-proxy": "Z" };
|
||||||
const line = s.toLine(p);
|
const line = s.toLine(p);
|
||||||
check("toLine", { name: "a$b", type: "ss", server: "h", port: 1, password: "x${Y}" },
|
check("toLine", { name: "a$b", type: "ss", server: "h", port: 1, password: "x${Y}", "dialer-proxy": "Z" },
|
||||||
line.includes("$") || !line.startsWith('{"name":') ? null : JSON.parse(line));
|
line.includes("$") || !line.startsWith('{"name":') ? null : JSON.parse(line));
|
||||||
process.exit(fail);
|
process.exit(fail);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user