Added my server pasrsing through sub

This commit is contained in:
Sam Latsin 2026-10-21 12:08:02 +03:00
parent 8b0076ea15
commit d7e277a437
15 changed files with 96 additions and 55 deletions

View File

@ -199,7 +199,7 @@ BOOT — whitelisted seed-ноды для скачивания подписок:
Пуши (Apple `*.push.apple.com` и подсети 17.x, Google FCM `mtalk.google.com`, порты Пуши (Apple `*.push.apple.com` и подсети 17.x, Google FCM `mtalk.google.com`, порты
5228–5230) идут через группу `PUSH`: на `main` по умолчанию `DIRECT`, на `whitelist` — `MY` 5228–5230) идут через группу `PUSH`: на `main` по умолчанию `DIRECT`, на `whitelist` — `MY`
(без своих серверов — `FOREIGN`); переключается в дашборде. Долгое соединение пушей (без своих hysteria2 — `FOREIGN`); переключается в дашборде. Долгое соединение пушей
рвётся, когда меняется нода под ним, — отсюда пропадающие уведомления. Отключается рвётся, когда меняется нода под ним, — отсюда пропадающие уведомления. Отключается
галочкой «Обход для пушей» (`PUSH=0` в `common.env`) — тогда пуши идут по общим правилам. галочкой «Обход для пушей» (`PUSH=0` в `common.env`) — тогда пуши идут по общим правилам.
@ -211,6 +211,17 @@ BOOT — whitelisted seed-ноды для скачивания подписок:
что в `FOREIGN`, но с `tolerance: 300`: меняет ноду, только если текущая заметно хуже или что в `FOREIGN`, но с `tolerance: 300`: меняет ноду, только если текущая заметно хуже или
умерла — каждая смена рвёт всё, что идёт через `MY`), на `main` — напрямую. умерла — каждая смена рвёт всё, что идёт через `MY`), на `main` — напрямую.
Свои серверы можно держать и в своей подписке: ноды, в имени которых есть `[MY]`
(`[MY] 🇩🇪 de-1`, регистр не важен), из любой подписки сами попадают в `MY`, а не в `RU` /
`FOREIGN` / `TORRENT`. Поменял адрес сервера в подписке — роутеры подхватят при
обновлении провайдера (раз в час или кнопкой в дашборде). Устроено так: основной
провайдер `<имя>` такие ноды отбрасывает, а рядом file-провайдер `<имя>-my` читает тот же
скачанный файл `providers/<имя>.yaml` (mihomo следит за ним, второго скачивания нет) и берёт
только их — свой провайдер нужен, чтобы на `whitelist` и телефоне ходить к ним через
`MY-EXIT`. Группа `MY` теперь есть
всегда; без hysteria2 и без `[MY]`-нод она пустая, и `PUSH` на `whitelist` тогда по
умолчанию `FOREIGN`.
CSQTT ([star-panel-csqtt](https://github.com/starkugz/csqtt-openwrt)) — резервный выход из белых CSQTT ([star-panel-csqtt](https://github.com/starkugz/csqtt-openwrt)) — резервный выход из белых
списков: галка «CSQTT» в LuCI → Настройка (`CSQTT=1` в `common.env`). Пакет ставится и списков: галка «CSQTT» в LuCI → Настройка (`CSQTT=1` в `common.env`). Пакет ставится и
настраивается отдельно, в своей панели (Службы → star-panel-csqtt); он поднимает интерфейс настраивается отдельно, в своей панели (Службы → star-panel-csqtt); он поднимает интерфейс

View File

@ -869,13 +869,14 @@ return view.extend({
'IP без маски = /32. Если адрес попал в несколько списков — побеждает MY, затем FOREIGN, затем RU.'), 'IP без маски = /32. Если адрес попал в несколько списков — побеждает MY, затем FOREIGN, затем RU.'),
field('Домены через RU', f.ru_domains, 'на main (свой белый IP) идут напрямую'), field('Домены через RU', f.ru_domains, 'на main (свой белый IP) идут напрямую'),
field('Домены через FOREIGN', f.foreign_domains), field('Домены через FOREIGN', f.foreign_domains),
field('Домены через MY', f.my_domains, 'свои серверы (ниже); без них список не действует'), field('Домены через MY', f.my_domains, 'свои серверы: ниже и [MY] из подписок'),
field('Доп. IP через RU', f.ru_ips, 'на main (свой белый IP) идут напрямую'), field('Доп. IP через RU', f.ru_ips, 'на main (свой белый IP) идут напрямую'),
field('Доп. IP через FOREIGN', f.foreign_ips), field('Доп. IP через FOREIGN', f.foreign_ips),
field('Доп. IP через MY', f.my_ips, 'свои серверы (ниже); без них список не действует'), field('Доп. IP через MY', f.my_ips, 'свои серверы: ниже и [MY] из подписок'),
E('h4', 'Свои серверы (hysteria2)'), E('h4', 'Свои серверы (hysteria2)'),
E('p', { 'class': 'cbi-value-description' }, 'Собираются в группу MY (автовыбор самого быстрого, в дашборде можно закрепить один). MY — пункт в MAIN ' + E('p', { 'class': 'cbi-value-description' }, 'Собираются в группу MY (автовыбор самого быстрого, в дашборде можно закрепить один). MY — пункт в MAIN ' +
'рядом с FOREIGN. К самим серверам на whitelist — через MY-EXIT, на main — напрямую.'), 'рядом с FOREIGN. К самим серверам на whitelist — через MY-EXIT, на main — напрямую. ' +
'Серверы из подписок с [MY] в имени (например «[MY] 🇩🇪 de-1») тоже попадают в MY, а не в FOREIGN/RU.'),
hy2List, hy2List,
importBox, importBox,
E('div', [ E('div', [

View File

@ -121,24 +121,26 @@ compute_tags() {
# CSQTT tunnel (star-panel-csqtt): last in MAIN (plain exit through its server) # CSQTT tunnel (star-panel-csqtt): last in MAIN (plain exit through its server)
CSQTT_MAIN="" CSQTT_MAIN=""
case "$TAGS" in *" csqtt "*) CSQTT_MAIN=", CSQTT" ;; esac case "$TAGS" in *" csqtt "*) CSQTT_MAIN=", CSQTT" ;; esac
SUB_LIST="" _i=0 # MY_SUB_LIST "a-my, b-my": providers of the "[MY] ..." nodes (group MY)
SUB_LIST="" MY_SUB_LIST="" _i=0
for _p in $SUB_PAIRS; do for _p in $SUB_PAIRS; do
sub_off "$_i" "${_p%%=*}" || SUB_LIST="${SUB_LIST:+$SUB_LIST, }${_p%%=*}" if ! sub_off "$_i" "${_p%%=*}"; then
SUB_LIST="${SUB_LIST:+$SUB_LIST, }${_p%%=*}"
MY_SUB_LIST="${MY_SUB_LIST:+$MY_SUB_LIST, }${_p%%=*}-my"
fi
_i=$((_i + 1)) _i=$((_i + 1))
done done
# own hysteria2 servers: HY2_LIST "a, b" (group MY), HY2_MAIN "MY, " (MAIN) # own hysteria2 servers: HY2_LIST "a, b" (group MY)
HY2_LIST="" HY2_MAIN="" HY2_LIST=""
for _n in $HY2; do for _n in $HY2; do
HY2_LIST="${HY2_LIST:+$HY2_LIST, }$_n" HY2_LIST="${HY2_LIST:+$HY2_LIST, }$_n"
done done
[ -n "$HY2" ] && TAGS="$TAGS hy2 " HY2_MAIN="MY, " [ -n "$HY2" ] && TAGS="$TAGS hy2 "
# OpenVPN through OVPN-EXIT (a RU node): whitelist and abroad # OpenVPN through OVPN-EXIT (a RU node): whitelist and abroad
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 *" hy2 "*" whitelist "* | *" whitelist "*" hy2 "* | *" hy2 "*" mobile "* | *" mobile "*" hy2 "*) case "$TAGS" in *" whitelist "* | *" mobile "*) TAGS="$TAGS my_exit " ;; esac
TAGS="$TAGS hy2_exit " ;; export SUB_LIST MY_SUB_LIST HY2_LIST CSQTT_MAIN
esac
export SUB_LIST HY2_LIST HY2_MAIN CSQTT_MAIN
} }
# vless_parse <vless://uuid@host:port?...&sni=..&pbk=..&sid=..#name> # vless_parse <vless://uuid@host:port?...&sni=..&pbk=..&sid=..#name>

View File

@ -44,7 +44,7 @@ TORRENT=1
# own lists, space separated, above torrents / ru-inside / .ru / MAIN; first match: # own lists, space separated, above torrents / ru-inside / .ru / MAIN; first match:
# MY, FOREIGN, RU. RU on main (home, own white IP) goes directly. IPs: CIDR (bare IP = /32); # MY, FOREIGN, RU. RU on main (home, own white IP) goes directly. IPs: CIDR (bare IP = /32);
# domains: with subdomains ("example.com" = "*.example.com"); MY_* need own servers (HY2) # domains: with subdomains ("example.com" = "*.example.com"); MY_*: group MY (HY2 and "[MY] ..." nodes of the subscriptions)
RU_IPS="194.190.191.112/32" RU_IPS="194.190.191.112/32"
#FOREIGN_IPS="1.2.3.0/24" #FOREIGN_IPS="1.2.3.0/24"
#MY_IPS="10.8.0.0/24" #MY_IPS="10.8.0.0/24"

View File

@ -1,21 +0,0 @@
# own hysteria2 servers: the fastest alive one; pin one in the dashboard if needed
- name: MY
type: url-test
proxies: [${HY2_LIST}]
url: "https://www.gstatic.com/generate_204"
interval: 300 #@!lite
interval: 600 #@lite
tolerance: 50
lazy: false #@!lite
lazy: true #@lite
# whitelist and mobile (hy2_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 #@hy2_exit
type: url-test #@hy2_exit
use: [${SUB_LIST}] #@hy2_exit
exclude-filter: "(?i)🇷🇺|\\bru\\b|russia|росси|моск" #@hy2_exit
url: "https://www.gstatic.com/generate_204" #@hy2_exit
interval: 300 #@hy2_exit
tolerance: 300 #@hy2_exit
lazy: false #@hy2_exit

View File

@ -0,0 +1,23 @@
# own servers: hysteria2 from the settings (HY2) 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
proxies: [${HY2_LIST}] #@hy2
use: [${MY_SUB_LIST}]
url: "https://www.gstatic.com/generate_204"
interval: 300 #@!lite
interval: 600 #@lite
tolerance: 50
lazy: false #@!lite
lazy: true #@lite
# 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 #@my_exit
type: url-test #@my_exit
use: [${SUB_LIST}] #@my_exit
exclude-filter: "(?i)🇷🇺|\\bru\\b|russia|росси|моск" #@my_exit
url: "https://www.gstatic.com/generate_204" #@my_exit
interval: 300 #@my_exit
tolerance: 300 #@my_exit
lazy: false #@my_exit

View File

@ -1,5 +1,5 @@
- name: MAIN - name: MAIN
type: select type: select
proxies: [FOREIGN, ${HY2_MAIN}RU, DIRECT${CSQTT_MAIN}] #@!foreign proxies: [FOREIGN, MY, RU, DIRECT${CSQTT_MAIN}] #@!foreign
# abroad: direct by default, own servers / pools by hand #@foreign # abroad: direct by default, own servers / pools by hand #@foreign
proxies: [DIRECT, ${HY2_MAIN}FOREIGN, RU${CSQTT_MAIN}] #@foreign proxies: [DIRECT, MY, FOREIGN, RU${CSQTT_MAIN}] #@foreign

View File

@ -1,4 +1,6 @@
- name: PUSH - name: PUSH
type: select type: select
proxies: [DIRECT, ${HY2_MAIN}FOREIGN] #@!whitelist proxies: [DIRECT, MY, FOREIGN] #@!whitelist
proxies: [${HY2_MAIN}FOREIGN, DIRECT] #@whitelist proxies: [MY, FOREIGN, DIRECT] #@whitelist,hy2
# no hysteria2: MY may be empty (no [MY] nodes in the subscriptions) #@whitelist,!hy2
proxies: [FOREIGN, MY, DIRECT] #@whitelist,!hy2

View File

@ -4,7 +4,7 @@
path: ./providers/${SUB_NAME}.yaml path: ./providers/${SUB_NAME}.yaml
interval: 3600 interval: 3600
proxy: ${@SUB_PROXY} proxy: ${@SUB_PROXY}
exclude-filter: "(?i)app not supported|приложение не|свяжитесь" exclude-filter: "(?i)app not supported|приложение не|свяжитесь|\\[MY\\]"
override: #@csqtt override: #@csqtt
dialer-proxy: UPLINK #@csqtt dialer-proxy: UPLINK #@csqtt
header: header:

View File

@ -0,0 +1,20 @@
# own servers kept in the subscription, named "[MY] ...", for group MY (the main
# provider leaves them out). Not a second download: reads the file the main
# provider saves (mihomo watches it); a provider of its own because on whitelist
# they go through MY-EXIT. ./providers exists before the start (ovpn_routes_write).
${SUB_NAME}-my:
type: file
path: ./providers/${SUB_NAME}.yaml
filter: "(?i)\\[MY\\]"
override: #@my_exit
dialer-proxy: MY-EXIT #@my_exit
override: #@csqtt,!my_exit
dialer-proxy: UPLINK #@csqtt,!my_exit
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

View File

@ -10,5 +10,5 @@
up: "${@@HY2_UP}" up: "${@@HY2_UP}"
down: "${@@HY2_DOWN}" down: "${@@HY2_DOWN}"
udp: true udp: true
dialer-proxy: MY-EXIT #@hy2_exit dialer-proxy: MY-EXIT #@my_exit
dialer-proxy: UPLINK #@csqtt,!hy2_exit dialer-proxy: UPLINK #@csqtt,!my_exit

View File

@ -2,11 +2,11 @@
# 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.
# RU on main (home, own white IP): reachable directly; whitelist/abroad: through RU # RU on main (home, own white IP): reachable directly; whitelist/abroad: through RU
- DOMAIN-SUFFIX,${@MY_DOMAINS},MY #@hy2 - DOMAIN-SUFFIX,${@MY_DOMAINS},MY
- DOMAIN-SUFFIX,${@FOREIGN_DOMAINS},FOREIGN - DOMAIN-SUFFIX,${@FOREIGN_DOMAINS},FOREIGN
- DOMAIN-SUFFIX,${@RU_DOMAINS},DIRECT #@main - DOMAIN-SUFFIX,${@RU_DOMAINS},DIRECT #@main
- DOMAIN-SUFFIX,${@RU_DOMAINS},RU #@!main - DOMAIN-SUFFIX,${@RU_DOMAINS},RU #@!main
- IP-CIDR,${@MY_IPS},MY #@hy2 - IP-CIDR,${@MY_IPS},MY
- IP-CIDR,${@FOREIGN_IPS},FOREIGN - IP-CIDR,${@FOREIGN_IPS},FOREIGN
- IP-CIDR,${@RU_IPS},DIRECT #@main - IP-CIDR,${@RU_IPS},DIRECT #@main
- IP-CIDR,${@RU_IPS},RU #@!main - IP-CIDR,${@RU_IPS},RU #@!main

View File

@ -4,5 +4,5 @@ TORRENT=0
RU_IPS="" RU_IPS=""
PUSH=0 PUSH=0
FOREIGN_IPS="9.9.9.9" FOREIGN_IPS="9.9.9.9"
# no own servers: MY lists are dropped # no hysteria2: MY still exists ("[MY] ..." nodes of the subscriptions)
MY_DOMAINS="home.example" MY_DOMAINS="home.example"

View File

@ -211,7 +211,7 @@
// OpenVPN through OVPN-EXIT: whitelist and abroad (see compute_tags) // OpenVPN through OVPN-EXIT: whitelist and abroad (see compute_tags)
if (t.has("router") && (t.has("whitelist") || t.has("foreign"))) t.add("ovpn_exit"); if (t.has("router") && (t.has("whitelist") || t.has("foreign"))) t.add("ovpn_exit");
// own servers through MY-EXIT: whitelist and the phone (see compute_tags) // own servers through MY-EXIT: whitelist and the phone (see compute_tags)
if (t.has("hy2") && (t.has("whitelist") || t.has("mobile"))) t.add("hy2_exit"); if (t.has("whitelist") || t.has("mobile")) t.add("my_exit");
return t; return t;
} }
@ -264,11 +264,12 @@
for (const k of ["RU_DOMAINS", "FOREIGN_DOMAINS", "MY_DOMAINS"]) v[k] = normList("dom", v[k]); for (const k of ["RU_DOMAINS", "FOREIGN_DOMAINS", "MY_DOMAINS"]) v[k] = normList("dom", v[k]);
const subs = subPairs(v.SUBS); const subs = subPairs(v.SUBS);
v.SUB_LIST = subs.filter((s, i) => !subOff(v, i, s.id)).map((s) => s.id).join(", "); v.SUB_LIST = subs.filter((s, i) => !subOff(v, i, s.id)).map((s) => s.id).join(", ");
// providers of the "[MY] ..." nodes (group MY)
v.MY_SUB_LIST = subs.filter((s, i) => !subOff(v, i, s.id)).map((s) => s.id + "-my").join(", ");
const seeds = bootSeeds(v); const seeds = bootSeeds(v);
v.SEED_LIST = seeds.map((s) => s.name).join(", "); v.SEED_LIST = seeds.map((s) => s.name).join(", ");
const hy2 = words(v.HY2); const hy2 = words(v.HY2);
v.HY2_LIST = hy2.join(", "); v.HY2_LIST = hy2.join(", ");
v.HY2_MAIN = hy2.length ? "MY, " : "";
// CSQTT tunnel (star-panel-csqtt): last in MAIN (plain exit through its server) // CSQTT tunnel (star-panel-csqtt): last in MAIN (plain exit through its server)
v.CSQTT_MAIN = tags.has("csqtt") ? ", CSQTT" : ""; v.CSQTT_MAIN = tags.has("csqtt") ? ", CSQTT" : "";

View File

@ -409,7 +409,7 @@
// OpenVPN through OVPN-EXIT: whitelist and abroad (see compute_tags) // OpenVPN through OVPN-EXIT: whitelist and abroad (see compute_tags)
if (t.has("router") && (t.has("whitelist") || t.has("foreign"))) t.add("ovpn_exit"); if (t.has("router") && (t.has("whitelist") || t.has("foreign"))) t.add("ovpn_exit");
// own servers through MY-EXIT: whitelist and the phone (see compute_tags) // own servers through MY-EXIT: whitelist and the phone (see compute_tags)
if (t.has("hy2") && (t.has("whitelist") || t.has("mobile"))) t.add("hy2_exit"); if (t.has("whitelist") || t.has("mobile")) t.add("my_exit");
return t; return t;
} }
@ -462,11 +462,12 @@
for (const k of ["RU_DOMAINS", "FOREIGN_DOMAINS", "MY_DOMAINS"]) v[k] = normList("dom", v[k]); for (const k of ["RU_DOMAINS", "FOREIGN_DOMAINS", "MY_DOMAINS"]) v[k] = normList("dom", v[k]);
const subs = subPairs(v.SUBS); const subs = subPairs(v.SUBS);
v.SUB_LIST = subs.filter((s, i) => !subOff(v, i, s.id)).map((s) => s.id).join(", "); v.SUB_LIST = subs.filter((s, i) => !subOff(v, i, s.id)).map((s) => s.id).join(", ");
// providers of the "[MY] ..." nodes (group MY)
v.MY_SUB_LIST = subs.filter((s, i) => !subOff(v, i, s.id)).map((s) => s.id + "-my").join(", ");
const seeds = bootSeeds(v); const seeds = bootSeeds(v);
v.SEED_LIST = seeds.map((s) => s.name).join(", "); v.SEED_LIST = seeds.map((s) => s.name).join(", ");
const hy2 = words(v.HY2); const hy2 = words(v.HY2);
v.HY2_LIST = hy2.join(", "); v.HY2_LIST = hy2.join(", ");
v.HY2_MAIN = hy2.length ? "MY, " : "";
// CSQTT tunnel (star-panel-csqtt): last in MAIN (plain exit through its server) // CSQTT tunnel (star-panel-csqtt): last in MAIN (plain exit through its server)
v.CSQTT_MAIN = tags.has("csqtt") ? ", CSQTT" : ""; v.CSQTT_MAIN = tags.has("csqtt") ? ", CSQTT" : "";
@ -522,19 +523,20 @@ const TEMPLATES = {
"groups/30-torrent.yaml": " - name: TORRENT\n type: url-test\n use: [${SUB_LIST}]\n filter: \"(?i)torrent|\\\\[tor\\\\]\"\n url: \"https://www.gstatic.com/generate_204\"\n interval: 300\n timeout: 6000\n tolerance: 500\n max-failed-times: 5\n lazy: false\n", "groups/30-torrent.yaml": " - name: TORRENT\n type: url-test\n use: [${SUB_LIST}]\n filter: \"(?i)torrent|\\\\[tor\\\\]\"\n url: \"https://www.gstatic.com/generate_204\"\n interval: 300\n timeout: 6000\n tolerance: 500\n max-failed-times: 5\n lazy: false\n",
"groups/40-openvpn.yaml": " # url: what the dashboard's delay test opens through the tunnel;\n # interval 0: no background checks (they would redial with a stale OTP)\n - name: ${OVPN_GROUP}\n type: select\n use: [${OVPN_PROVIDER}]\n url: \"${OVPN_CHECK_URL}\"\n interval: 0\n", "groups/40-openvpn.yaml": " # url: what the dashboard's delay test opens through the tunnel;\n # interval 0: no background checks (they would redial with a stale OTP)\n - name: ${OVPN_GROUP}\n type: select\n use: [${OVPN_PROVIDER}]\n url: \"${OVPN_CHECK_URL}\"\n interval: 0\n",
"groups/41-openvpn.ovpn_exit.yaml": " # what the OpenVPN tunnel itself goes through on whitelist and foreign (ovpn_exit).\n # select, not url-test: switching nodes would break the tunnel.\n # Pick a concrete RU node in the dashboard, the choice is remembered.\n - name: OVPN-EXIT\n type: select\n use: [${SUB_LIST}]\n filter: \"(?i)🇷🇺|\\\\bru\\\\b|russia|росси|моск\"\n", "groups/41-openvpn.ovpn_exit.yaml": " # what the OpenVPN tunnel itself goes through on whitelist and foreign (ovpn_exit).\n # select, not url-test: switching nodes would break the tunnel.\n # Pick a concrete RU node in the dashboard, the choice is remembered.\n - name: OVPN-EXIT\n type: select\n use: [${SUB_LIST}]\n filter: \"(?i)🇷🇺|\\\\bru\\\\b|russia|росси|моск\"\n",
"groups/45-hy2.yaml": " # own hysteria2 servers: the fastest alive one; pin one in the dashboard if needed\n - name: MY\n type: url-test\n proxies: [${HY2_LIST}]\n url: \"https://www.gstatic.com/generate_204\"\n interval: 300 #@!lite\n interval: 600 #@lite\n tolerance: 50\n lazy: false #@!lite\n lazy: true #@lite\n\n # whitelist and mobile (hy2_exit): what own servers are reached through; switches only when the node is\n # clearly worse or dead (each switch breaks everything going through MY)\n - name: MY-EXIT #@hy2_exit\n type: url-test #@hy2_exit\n use: [${SUB_LIST}] #@hy2_exit\n exclude-filter: \"(?i)🇷🇺|\\\\bru\\\\b|russia|росси|моск\" #@hy2_exit\n url: \"https://www.gstatic.com/generate_204\" #@hy2_exit\n interval: 300 #@hy2_exit\n tolerance: 300 #@hy2_exit\n lazy: false #@hy2_exit\n", "groups/45-sub.yaml": " # own servers: hysteria2 from the settings (HY2) and the \"[MY] ...\" nodes of the\n # subscriptions (providers <id>-my); the fastest alive one; pin one in the dashboard if needed\n - name: MY\n type: url-test\n proxies: [${HY2_LIST}] #@hy2\n use: [${MY_SUB_LIST}]\n url: \"https://www.gstatic.com/generate_204\"\n interval: 300 #@!lite\n interval: 600 #@lite\n tolerance: 50\n lazy: false #@!lite\n lazy: true #@lite\n\n # whitelist and mobile (my_exit): what own servers are reached through; switches only when the node is\n # clearly worse or dead (each switch breaks everything going through MY)\n - name: MY-EXIT #@my_exit\n type: url-test #@my_exit\n use: [${SUB_LIST}] #@my_exit\n exclude-filter: \"(?i)🇷🇺|\\\\bru\\\\b|russia|росси|моск\" #@my_exit\n url: \"https://www.gstatic.com/generate_204\" #@my_exit\n interval: 300 #@my_exit\n tolerance: 300 #@my_exit\n lazy: false #@my_exit\n",
"groups/50-tailscale.yaml": " # url (TS_CHECK_URL, optional): a tailnet service for the dashboard's delay test\n - name: TAILSCALE\n type: select\n proxies: [tailscale]\n url: \"${@TS_CHECK_URL}\"\n interval: 0\n", "groups/50-tailscale.yaml": " # url (TS_CHECK_URL, optional): a tailnet service for the dashboard's delay test\n - name: TAILSCALE\n type: select\n proxies: [tailscale]\n url: \"${@TS_CHECK_URL}\"\n interval: 0\n",
"groups/51-tailscale.ts_exit.yaml": " # Tailscale needs full-cone UDP from its dialer-proxy: vless/vmess/trojan\n # cannot do it in mihomo, so only ss / hysteria2 / tuic / socks5 nodes here.\n - name: TS-EXIT\n type: select\n proxies: [MY] #@hy2\n use: [${SUB_LIST}]\n exclude-type: \"vless|vmess|trojan\"\n", "groups/51-tailscale.ts_exit.yaml": " # Tailscale needs full-cone UDP from its dialer-proxy: vless/vmess/trojan\n # cannot do it in mihomo, so only ss / hysteria2 / tuic / socks5 nodes here.\n - name: TS-EXIT\n type: select\n proxies: [MY] #@hy2\n use: [${SUB_LIST}]\n exclude-type: \"vless|vmess|trojan\"\n",
"groups/60-csqtt.yaml": " # UPLINK: what the subscription nodes, BOOT seeds and own servers connect\n # through. DIRECT - as before; CSQTT - through csqtt0 first (out of the\n # whitelist), then FOREIGN / MY / RU work on top of it as usual.\n # On whitelist own servers go MY-EXIT -> node -> UPLINK.\n - name: UPLINK\n type: select\n proxies: [DIRECT, CSQTT]\n", "groups/60-csqtt.yaml": " # UPLINK: what the subscription nodes, BOOT seeds and own servers connect\n # through. DIRECT - as before; CSQTT - through csqtt0 first (out of the\n # whitelist), then FOREIGN / MY / RU work on top of it as usual.\n # On whitelist own servers go MY-EXIT -> node -> UPLINK.\n - name: UPLINK\n type: select\n proxies: [DIRECT, CSQTT]\n",
"groups/90-base.yaml": " - name: MAIN\n type: select\n proxies: [FOREIGN, ${HY2_MAIN}RU, DIRECT${CSQTT_MAIN}] #@!foreign\n # abroad: direct by default, own servers / pools by hand #@foreign\n proxies: [DIRECT, ${HY2_MAIN}FOREIGN, RU${CSQTT_MAIN}] #@foreign\n", "groups/90-base.yaml": " - name: MAIN\n type: select\n proxies: [FOREIGN, MY, RU, DIRECT${CSQTT_MAIN}] #@!foreign\n # abroad: direct by default, own servers / pools by hand #@foreign\n proxies: [DIRECT, MY, FOREIGN, RU${CSQTT_MAIN}] #@foreign\n",
"groups/91-torrent.yaml": " - name: TORRENT-SEL\n type: select\n proxies: [TORRENT, FOREIGN, DIRECT]\n", "groups/91-torrent.yaml": " - name: TORRENT-SEL\n type: select\n proxies: [TORRENT, FOREIGN, DIRECT]\n",
"groups/92-push.yaml": " - name: PUSH\n type: select\n proxies: [DIRECT, ${HY2_MAIN}FOREIGN] #@!whitelist\n proxies: [${HY2_MAIN}FOREIGN, DIRECT] #@whitelist\n", "groups/92-push.yaml": " - name: PUSH\n type: select\n proxies: [DIRECT, MY, FOREIGN] #@!whitelist\n proxies: [MY, FOREIGN, DIRECT] #@whitelist,hy2\n # no hysteria2: MY may be empty (no [MY] nodes in the subscriptions) #@whitelist,!hy2\n proxies: [FOREIGN, MY, DIRECT] #@whitelist,!hy2\n",
"head/10-lite.yaml": "# LITE=1 (weak routers). nikki's mixin overrides keys whose uci options are set\n# (mihomo-kit.sh puts log_level / match_process there); these cover the rest\nlog-level: warning\nfind-process-mode: off #@!csqtt\ntcp-concurrent: false\nunified-delay: false\ngeo-auto-update: false\n", "head/10-lite.yaml": "# LITE=1 (weak routers). nikki's mixin overrides keys whose uci options are set\n# (mihomo-kit.sh puts log_level / match_process there); these cover the rest\nlog-level: warning\nfind-process-mode: off #@!csqtt\ntcp-concurrent: false\nunified-delay: false\ngeo-auto-update: false\n",
"providers/10-sub.each.yaml": " ${SUB_NAME}:\n type: http\n url: \"${SUB_URL}\"\n path: ./providers/${SUB_NAME}.yaml\n interval: 3600\n proxy: ${@SUB_PROXY}\n exclude-filter: \"(?i)app not supported|приложение не|свяжитесь\"\n override: #@csqtt\n dialer-proxy: UPLINK #@csqtt\n header:\n User-Agent: [\"${SUB_UA}\"]\n ${@@SUB_HEADERS}\n # one check per provider: the groups over it (use:) only add their URLs to it,\n # so the interval and lazy here are what counts for RU/FOREIGN/TORRENT/MY-EXIT.\n # lite: every 10 min and skipped while no traffic used the provider\n health-check:\n enable: true\n url: \"https://www.gstatic.com/generate_204\"\n interval: 300 #@!lite\n interval: 600 #@lite\n timeout: 3000\n lazy: false #@!lite\n lazy: true #@lite\n", "providers/10-sub.each.yaml": " ${SUB_NAME}:\n type: http\n url: \"${SUB_URL}\"\n path: ./providers/${SUB_NAME}.yaml\n interval: 3600\n proxy: ${@SUB_PROXY}\n exclude-filter: \"(?i)app not supported|приложение не|свяжитесь|\\\\[MY\\\\]\"\n override: #@csqtt\n dialer-proxy: UPLINK #@csqtt\n header:\n User-Agent: [\"${SUB_UA}\"]\n ${@@SUB_HEADERS}\n # one check per provider: the groups over it (use:) only add their URLs to it,\n # so the interval and lazy here are what counts for RU/FOREIGN/TORRENT/MY-EXIT.\n # lite: every 10 min and skipped while no traffic used the provider\n health-check:\n enable: true\n url: \"https://www.gstatic.com/generate_204\"\n interval: 300 #@!lite\n interval: 600 #@lite\n timeout: 3000\n lazy: false #@!lite\n lazy: true #@lite\n",
"providers/15-sub.each.yaml": " # own servers kept in the subscription, named \"[MY] ...\", for group MY (the main\n # provider leaves them out). Not a second download: reads the file the main\n # provider saves (mihomo watches it); a provider of its own because on whitelist\n # they go through MY-EXIT. ./providers exists before the start (ovpn_routes_write).\n ${SUB_NAME}-my:\n type: file\n path: ./providers/${SUB_NAME}.yaml\n filter: \"(?i)\\\\[MY\\\\]\"\n override: #@my_exit\n dialer-proxy: MY-EXIT #@my_exit\n override: #@csqtt,!my_exit\n dialer-proxy: UPLINK #@csqtt,!my_exit\n health-check:\n enable: true\n url: \"https://www.gstatic.com/generate_204\"\n interval: 300 #@!lite\n interval: 600 #@lite\n timeout: 3000\n lazy: false #@!lite\n lazy: true #@lite\n",
"providers/20-openvpn.yaml": " # OpenVPN: file written on the router by bmstu-otp.sh (fresh TOTP in the\n # password). No health-check here: a dead tunnel would be redialed with a\n # stale OTP; the cron watchdog (bmstu-otp.sh check) handles it.\n ${OVPN_PROVIDER}:\n type: file\n path: ./providers/${OVPN_PROVIDER}.yaml\n health-check:\n enable: false\n override: #@ovpn_exit\n dialer-proxy: OVPN-EXIT #@ovpn_exit\n", "providers/20-openvpn.yaml": " # OpenVPN: file written on the router by bmstu-otp.sh (fresh TOTP in the\n # password). No health-check here: a dead tunnel would be redialed with a\n # stale OTP; the cron watchdog (bmstu-otp.sh check) handles it.\n ${OVPN_PROVIDER}:\n type: file\n path: ./providers/${OVPN_PROVIDER}.yaml\n health-check:\n enable: false\n override: #@ovpn_exit\n dialer-proxy: OVPN-EXIT #@ovpn_exit\n",
"proxies/10-boot.each.yaml": " - name: ${SEED_NAME}\n type: vless\n server: ${SEED_SERVER}\n port: ${SEED_PORT}\n uuid: ${SEED_UUID}\n network: tcp\n udp: true\n tls: true\n flow: xtls-rprx-vision\n servername: ${SEED_SNI}\n client-fingerprint: firefox\n reality-opts:\n public-key: ${SEED_PBK}\n short-id: ${SEED_SID}\n dialer-proxy: UPLINK #@csqtt\n", "proxies/10-boot.each.yaml": " - name: ${SEED_NAME}\n type: vless\n server: ${SEED_SERVER}\n port: ${SEED_PORT}\n uuid: ${SEED_UUID}\n network: tcp\n udp: true\n tls: true\n flow: xtls-rprx-vision\n servername: ${SEED_SNI}\n client-fingerprint: firefox\n reality-opts:\n public-key: ${SEED_PBK}\n short-id: ${SEED_SID}\n dialer-proxy: UPLINK #@csqtt\n",
"proxies/20-tailscale.yaml": " # Tailscale: userspace node, starts on first use. First login: open the URL\n # from the nikki log (\"To start this tsnet server ... go to: ...\"), then\n # disable key expiry for this node. Needs TS_FORCE_NOISE_443=true in the\n # mihomo environment (mihomo-kit.sh fix).\n - name: tailscale\n type: tailscale\n hostname: ${TS_HOSTNAME}\n state-dir: ./tailscale\n udp: true\n accept-routes: true\n dialer-proxy: TS-EXIT #@ts_exit\n # whitelist: control and DERP over TCP through own servers (MY -> hysteria2 -> MY-EXIT); #@whitelist,hy2,!ts_exit\n # needs the kit's core (v1.19.32-ts1, tools/core/*.patch, MetaCubeX/mihomo#3142) #@whitelist,hy2,!ts_exit\n dialer-proxy: MY #@whitelist,hy2,!ts_exit\n", "proxies/20-tailscale.yaml": " # Tailscale: userspace node, starts on first use. First login: open the URL\n # from the nikki log (\"To start this tsnet server ... go to: ...\"), then\n # disable key expiry for this node. Needs TS_FORCE_NOISE_443=true in the\n # mihomo environment (mihomo-kit.sh fix).\n - name: tailscale\n type: tailscale\n hostname: ${TS_HOSTNAME}\n state-dir: ./tailscale\n udp: true\n accept-routes: true\n dialer-proxy: TS-EXIT #@ts_exit\n # whitelist: control and DERP over TCP through own servers (MY -> hysteria2 -> MY-EXIT); #@whitelist,hy2,!ts_exit\n # needs the kit's core (v1.19.32-ts1, tools/core/*.patch, MetaCubeX/mihomo#3142) #@whitelist,hy2,!ts_exit\n dialer-proxy: MY #@whitelist,hy2,!ts_exit\n",
"proxies/30-hy2.each.yaml": " - name: ${HY2_NAME}\n type: hysteria2\n server: ${HY2_SERVER}\n port: ${HY2_PORT}\n password: \"${HY2_PASSWORD}\"\n obfs: ${@HY2_OBFS}\n obfs-password: \"${@@HY2_OBFS_PASSWORD}\"\n sni: ${@HY2_SNI}\n skip-cert-verify: ${HY2_INSECURE}\n up: \"${@@HY2_UP}\"\n down: \"${@@HY2_DOWN}\"\n udp: true\n dialer-proxy: MY-EXIT #@hy2_exit\n dialer-proxy: UPLINK #@csqtt,!hy2_exit\n", "proxies/30-hy2.each.yaml": " - name: ${HY2_NAME}\n type: hysteria2\n server: ${HY2_SERVER}\n port: ${HY2_PORT}\n password: \"${HY2_PASSWORD}\"\n obfs: ${@HY2_OBFS}\n obfs-password: \"${@@HY2_OBFS_PASSWORD}\"\n sni: ${@HY2_SNI}\n skip-cert-verify: ${HY2_INSECURE}\n up: \"${@@HY2_UP}\"\n down: \"${@@HY2_DOWN}\"\n udp: true\n dialer-proxy: MY-EXIT #@my_exit\n dialer-proxy: UPLINK #@csqtt,!my_exit\n",
"proxies/40-csqtt.yaml": " # CSQTT (star-panel-csqtt): tunnel interface csqtt0 on the router, mihomo\n # just sends the connection out of it (the interface does not change routes)\n - name: CSQTT\n type: direct\n interface-name: ${CSQTT_IFACE}\n udp: true\n", "proxies/40-csqtt.yaml": " # CSQTT (star-panel-csqtt): tunnel interface csqtt0 on the router, mihomo\n # just sends the connection out of it (the interface does not change routes)\n - name: CSQTT\n type: direct\n interface-name: ${CSQTT_IFACE}\n udp: true\n",
"rule-providers/10-base.yaml": " # Russian services (geosite ru-inside of russia-only, as .mrs): an ordinary\n # http rule-set, so every client fetches it with the config, no geodata setup\n ru-inside:\n type: http\n behavior: domain\n format: mrs\n url: \"${RULESET_URL}/ru-inside.mrs\"\n path: ./ruleset/ru-inside.mrs\n interval: 86400\n", "rule-providers/10-base.yaml": " # Russian services (geosite ru-inside of russia-only, as .mrs): an ordinary\n # http rule-set, so every client fetches it with the config, no geodata setup\n ru-inside:\n type: http\n behavior: domain\n format: mrs\n url: \"${RULESET_URL}/ru-inside.mrs\"\n path: ./ruleset/ru-inside.mrs\n interval: 86400\n",
"rule-providers/20-openvpn.yaml": " # OpenVPN routes (OVPN_ROUTES): the file is written by mihomo-kit.sh build and\n # emptied by bmstu-otp.sh off, so with the tunnel off these addresses follow\n # the normal rules instead of a dead BMSTU group\n ${OVPN_PROVIDER}-routes:\n type: file\n behavior: ipcidr\n path: ./providers/${OVPN_PROVIDER}-routes.yaml\n", "rule-providers/20-openvpn.yaml": " # OpenVPN routes (OVPN_ROUTES): the file is written by mihomo-kit.sh build and\n # emptied by bmstu-otp.sh off, so with the tunnel off these addresses follow\n # the normal rules instead of a dead BMSTU group\n ${OVPN_PROVIDER}-routes:\n type: file\n behavior: ipcidr\n path: ./providers/${OVPN_PROVIDER}-routes.yaml\n",
@ -543,7 +545,7 @@ const TEMPLATES = {
"rules/20-openvpn.yaml": " # OpenVPN server itself must not go into its own tunnel\n - IP-CIDR,${@OVPN_SERVER_IPS}/32,DIRECT,no-resolve #@!ovpn_exit\n - IP-CIDR,${@OVPN_SERVER_IPS}/32,OVPN-EXIT,no-resolve #@ovpn_exit\n - DOMAIN,${OVPN_SERVER_HOST},DIRECT #@!ovpn_exit\n - DOMAIN,${OVPN_SERVER_HOST},OVPN-EXIT #@ovpn_exit\n # networks pushed by the server (before the private-range DIRECT rules);\n # a rule-provider so that bmstu-otp.sh off can drop them without a restart\n - RULE-SET,${OVPN_PROVIDER}-routes,${OVPN_GROUP},no-resolve\n", "rules/20-openvpn.yaml": " # OpenVPN server itself must not go into its own tunnel\n - IP-CIDR,${@OVPN_SERVER_IPS}/32,DIRECT,no-resolve #@!ovpn_exit\n - IP-CIDR,${@OVPN_SERVER_IPS}/32,OVPN-EXIT,no-resolve #@ovpn_exit\n - DOMAIN,${OVPN_SERVER_HOST},DIRECT #@!ovpn_exit\n - DOMAIN,${OVPN_SERVER_HOST},OVPN-EXIT #@ovpn_exit\n # networks pushed by the server (before the private-range DIRECT rules);\n # a rule-provider so that bmstu-otp.sh off can drop them without a restart\n - RULE-SET,${OVPN_PROVIDER}-routes,${OVPN_GROUP},no-resolve\n",
"rules/30-base.yaml": " - IP-CIDR,192.168.0.0/16,DIRECT,no-resolve\n - IP-CIDR,10.0.0.0/8,DIRECT,no-resolve\n - IP-CIDR,172.16.0.0/12,DIRECT,no-resolve\n", "rules/30-base.yaml": " - IP-CIDR,192.168.0.0/16,DIRECT,no-resolve\n - IP-CIDR,10.0.0.0/8,DIRECT,no-resolve\n - IP-CIDR,172.16.0.0/12,DIRECT,no-resolve\n",
"rules/35-push.yaml": " # push notifications (Apple APNs, Google FCM): long-lived connections on a\n # stable path - group PUSH (main/foreign: DIRECT, whitelist: MY)\n - DOMAIN-SUFFIX,push.apple.com,PUSH\n - IP-CIDR,17.249.0.0/16,PUSH,no-resolve\n - IP-CIDR,17.252.0.0/16,PUSH,no-resolve\n - IP-CIDR,17.57.144.0/22,PUSH,no-resolve\n - IP-CIDR,17.188.128.0/18,PUSH,no-resolve\n - IP-CIDR,17.188.20.0/23,PUSH,no-resolve\n - DOMAIN-REGEX,^(alt[0-9]+-)?mtalk[0-9]*\\.google\\.com$,PUSH\n - DST-PORT,5228-5230,PUSH\n", "rules/35-push.yaml": " # push notifications (Apple APNs, Google FCM): long-lived connections on a\n # stable path - group PUSH (main/foreign: DIRECT, whitelist: MY)\n - DOMAIN-SUFFIX,push.apple.com,PUSH\n - IP-CIDR,17.249.0.0/16,PUSH,no-resolve\n - IP-CIDR,17.252.0.0/16,PUSH,no-resolve\n - IP-CIDR,17.57.144.0/22,PUSH,no-resolve\n - IP-CIDR,17.188.128.0/18,PUSH,no-resolve\n - IP-CIDR,17.188.20.0/23,PUSH,no-resolve\n - DOMAIN-REGEX,^(alt[0-9]+-)?mtalk[0-9]*\\.google\\.com$,PUSH\n - DST-PORT,5228-5230,PUSH\n",
"rules/40-base.yaml": " # own lists from the settings: above torrents, ru-inside, .ru and MATCH; below the\n # tunnels, LAN and push. Domains (DOMAIN-SUFFIX: the domain and all subdomains)\n # before IPs; first match wins: MY, then FOREIGN, then RU.\n # RU on main (home, own white IP): reachable directly; whitelist/abroad: through RU\n - DOMAIN-SUFFIX,${@MY_DOMAINS},MY #@hy2\n - DOMAIN-SUFFIX,${@FOREIGN_DOMAINS},FOREIGN\n - DOMAIN-SUFFIX,${@RU_DOMAINS},DIRECT #@main\n - DOMAIN-SUFFIX,${@RU_DOMAINS},RU #@!main\n - IP-CIDR,${@MY_IPS},MY #@hy2\n - IP-CIDR,${@FOREIGN_IPS},FOREIGN\n - IP-CIDR,${@RU_IPS},DIRECT #@main\n - IP-CIDR,${@RU_IPS},RU #@!main\n", "rules/40-base.yaml": " # own lists from the settings: above torrents, ru-inside, .ru and MATCH; below the\n # tunnels, LAN and push. Domains (DOMAIN-SUFFIX: the domain and all subdomains)\n # before IPs; first match wins: MY, then FOREIGN, then RU.\n # RU on main (home, own white IP): reachable directly; whitelist/abroad: through RU\n - DOMAIN-SUFFIX,${@MY_DOMAINS},MY\n - DOMAIN-SUFFIX,${@FOREIGN_DOMAINS},FOREIGN\n - DOMAIN-SUFFIX,${@RU_DOMAINS},DIRECT #@main\n - DOMAIN-SUFFIX,${@RU_DOMAINS},RU #@!main\n - IP-CIDR,${@MY_IPS},MY\n - IP-CIDR,${@FOREIGN_IPS},FOREIGN\n - IP-CIDR,${@RU_IPS},DIRECT #@main\n - IP-CIDR,${@RU_IPS},RU #@!main\n",
"rules/50-torrent.yaml": " - SRC-PORT,20000-20199,TORRENT-SEL\n", "rules/50-torrent.yaml": " - SRC-PORT,20000-20199,TORRENT-SEL\n",
"rules/90-base.yaml": " - RULE-SET,ru-inside,DIRECT #@!foreign\n # abroad: Russian services through the RU pool too #@foreign\n - RULE-SET,ru-inside,RU #@foreign\n # main (home, own white IP): .ru/.рф directly; elsewhere through RU\n - DOMAIN-SUFFIX,ru,DIRECT #@main\n - DOMAIN-SUFFIX,xn--p1ai,DIRECT #@main\n - DOMAIN-SUFFIX,ru,RU #@!main\n - DOMAIN-SUFFIX,xn--p1ai,RU #@!main\n - MATCH,MAIN\n", "rules/90-base.yaml": " - RULE-SET,ru-inside,DIRECT #@!foreign\n # abroad: Russian services through the RU pool too #@foreign\n - RULE-SET,ru-inside,RU #@foreign\n # main (home, own white IP): .ru/.рф directly; elsewhere through RU\n - DOMAIN-SUFFIX,ru,DIRECT #@main\n - DOMAIN-SUFFIX,xn--p1ai,DIRECT #@main\n - DOMAIN-SUFFIX,ru,RU #@!main\n - DOMAIN-SUFFIX,xn--p1ai,RU #@!main\n - MATCH,MAIN\n",
"sniffer/10-base.yaml": "sniffer:\n enable: true\n force-dns-mapping: true\n parse-pure-ip: true\n override-destination: false\n sniff:\n HTTP:\n ports: [80, 8080-8880] #@!lite\n ports: [80, 8080] #@lite\n TLS:\n ports: [443, 8443]\n # lite: no QUIC (fake-ip already gives the domain; pure-IP QUIC goes by IP)\n QUIC: #@!lite\n ports: [443, 8443] #@!lite\n" "sniffer/10-base.yaml": "sniffer:\n enable: true\n force-dns-mapping: true\n parse-pure-ip: true\n override-destination: false\n sniff:\n HTTP:\n ports: [80, 8080-8880] #@!lite\n ports: [80, 8080] #@lite\n TLS:\n ports: [443, 8443]\n # lite: no QUIC (fake-ip already gives the domain; pure-IP QUIC goes by IP)\n QUIC: #@!lite\n ports: [443, 8443] #@!lite\n"