Added mobile config support

This commit is contained in:
Sam Latsin 2026-10-11 01:36:55 +03:00
parent 736ab15790
commit 6e7f92e5ea
10 changed files with 135 additions and 16 deletions

View File

@ -145,6 +145,19 @@ BOOT — whitelisted seed-ноды для скачивания подписок:
## Телефон (FlClash) ## Телефон (FlClash)
С роутера: LuCI → Настройка → галка «Конфиг для телефона» → «Сохранить и применить». На
странице появится блок «Телефон (FlClash)» с QR-кодом и ссылкой
`http://<роутер>/mihomo-kit/<токен>.yaml`: FlClash → Профили → + → по ссылке (или QR).
Это `common.env`, собранный с `TARGET=mobile`: те же подписки, BOOT/`BOOT-AUTO`, HWID и
RU-адреса, без OpenVPN, Tailscale, торрентов и `PUSH`; свои серверы — в `MY`, к ним всегда
через `MY-EXIT` (телефон часто на белых списках). Пересобирается вместе с профилями.
Ссылка открывается только в сети роутера (вне дома FlClash просто не обновит профиль) и
содержит ссылки подписок — токен и есть секрет; «Новая ссылка» (`mihomo-kit.sh mobile new`)
отзывает старую.
Без роутера — веб-конструктор:
Открыть [web/index.html](web/index.html) (из репозитория или со своего хостинга) → Открыть [web/index.html](web/index.html) (из репозитория или со своего хостинга) →
«Телефон» → подписки и vless-ссылка BOOT → «Скачать» → FlClash: Профили → + → Файл. «Телефон» → подписки и vless-ссылка BOOT → «Скачать» → FlClash: Профили → + → Файл.
Страница всё считает в браузере и никуда ничего не отправляет. Страница всё считает в браузере и никуда ничего не отправляет.

View File

@ -137,6 +137,19 @@ function parseHy2(text) {
}); });
} }
// qrcode-generator (luci/qrcode.js, installed with the page): a global "qrcode"
function loadQr() {
if (window.qrcode)
return Promise.resolve(window.qrcode);
return new Promise(function(resolve, reject) {
var s = document.createElement('script');
s.src = L.resource('mihomo-kit/qrcode.js');
s.onload = function() { resolve(window.qrcode); };
s.onerror = function() { reject(new Error('qrcode.js not loaded')); };
document.head.appendChild(s);
});
}
function readFile(input) { function readFile(input) {
var f = input.files && input.files[0]; var f = input.files && input.files[0];
if (!f) if (!f)
@ -269,6 +282,31 @@ return view.extend({
])); ]));
} }
if (st.mobile_path) {
var mobUrl = window.location.protocol + '//' + window.location.host + st.mobile_path;
var qrBox = E('div', { 'style': 'width:220px;max-width:100%;background:#fff;padding:8px;border-radius:4px' }, E('em', 'QR…'));
loadQr().then(function(qrcode) {
var q = qrcode(0, 'M');
q.addData(mobUrl);
q.make();
qrBox.innerHTML = q.createSvgTag({ cellSize: 4, margin: 2, scalable: true });
}).catch(function(e) { dom.content(qrBox, String(e)); });
sections.push(section('Телефон (FlClash)', [
E('div', { 'style': 'display:flex;gap:1.5em;flex-wrap:wrap;align-items:flex-start' }, [
qrBox,
E('div', { 'style': 'flex:1;min-width:16em' }, [
E('p', 'FlClash → Профили → + → по ссылке (или QR) — профиль из тех же подписок и BOOT, ' +
'без OpenVPN, Tailscale и торрентов; свои серверы — через MY-EXIT.'),
E('p', [ E('a', { 'href': mobUrl, 'target': '_blank', 'rel': 'noreferrer' }, mobUrl) ]),
E('p', { 'class': 'cbi-value-description' }, 'Ссылка работает только в сети роутера: вне дома FlClash ' +
'просто не обновит профиль. В ней ссылки подписок — не пересылай; «Новая ссылка» отзывает старую.'),
this.button('Новая ссылка', 'negative', 'mobile-new', null,
'Выдать новую ссылку? Старая перестанет работать, в FlClash профиль надо будет добавить заново.')
])
])
]));
}
sections.push(section('Обслуживание', [ sections.push(section('Обслуживание', [
E('table', { 'class': 'table' }, [ E('table', { 'class': 'table' }, [
row(this.button('Пересобрать профили', 'action', 'build'), row(this.button('Пересобрать профили', 'action', 'build'),
@ -322,7 +360,8 @@ return view.extend({
ts_hostname: text(cfg.ts_hostname), ts_hostname: text(cfg.ts_hostname),
ts_domains: text(cfg.ts_domains, 'corp.example.com'), ts_domains: text(cfg.ts_domains, 'corp.example.com'),
ovpn_check_url: text(cfg.ovpn_check_url, 'https://eu.bmstu.ru'), ovpn_check_url: text(cfg.ovpn_check_url, 'https://eu.bmstu.ru'),
ts_check_url: text(cfg.ts_check_url, 'http://100.69.216.50:8080') ts_check_url: text(cfg.ts_check_url, 'http://100.69.216.50:8080'),
mobile: check(cfg.mobile)
}; };
var update = function() { var update = function() {
@ -517,6 +556,7 @@ return view.extend({
ts_domains: f.ts_domains.value.trim(), ts_domains: f.ts_domains.value.trim(),
ovpn_check_url: f.ovpn_check_url.value.trim(), ovpn_check_url: f.ovpn_check_url.value.trim(),
ts_check_url: f.ts_check_url.value.trim(), ts_check_url: f.ts_check_url.value.trim(),
mobile: f.mobile.checked,
hy2: hy2Data hy2: hy2Data
}); });
}, this)).then(L.bind(function(r) { }, this)).then(L.bind(function(r) {
@ -548,6 +588,8 @@ return view.extend({
ovpnBox, ovpnBox,
field('Tailscale', f.tailscale), field('Tailscale', f.tailscale),
tsBox, tsBox,
field('Конфиг для телефона', f.mobile, 'FlClash: QR и ссылка появятся на этой странице после сохранения ' +
'(файл раздаётся роутером внутри LAN по ссылке со случайным токеном)'),
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. К самим серверам на street — через FOREIGN-ноду, на home — напрямую.'), 'рядом с FOREIGN. К самим серверам на street — через FOREIGN-ноду, на home — напрямую.'),

3
luci/qrcode.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -71,6 +71,9 @@ m_status() {
json_add_boolean ts_logged_in "$(b grep -q _current-profile "$NIKKI_DIR/run/tailscale/tailscaled.state")" json_add_boolean ts_logged_in "$(b grep -q _current-profile "$NIKKI_DIR/run/tailscale/tailscaled.state")"
json_add_string kit_version "$(cat "$NIKKI_DIR/kit/VERSION" 2>/dev/null)" json_add_string kit_version "$(cat "$NIKKI_DIR/kit/VERSION" 2>/dev/null)"
json_add_boolean auto_update "$(b grep -q 'mihomo-kit.sh auto-update' /etc/crontabs/root)" json_add_boolean auto_update "$(b grep -q 'mihomo-kit.sh auto-update' /etc/crontabs/root)"
# phone config (MOBILE=1): /mihomo-kit/<token>.yaml served by uhttpd
mob=$(ls /www/mihomo-kit/*.yaml 2>/dev/null | head -n 1)
json_add_string mobile_path "${mob:+/mihomo-kit/${mob##*/}}"
json_add_string auto_update_last "$(tail -n 1 "$NIKKI_DIR/kit/auto-update.log" 2>/dev/null)" json_add_string auto_update_last "$(tail -n 1 "$NIKKI_DIR/kit/auto-update.log" 2>/dev/null)"
l=$(uci -q get nikki.mixin.api_listen) l=$(uci -q get nikki.mixin.api_listen)
port=${l##*:} port=${l##*:}
@ -137,6 +140,7 @@ m_run() {
build | update | fix) set -- mihomo-kit.sh "$cmd" ;; build | update | fix) set -- mihomo-kit.sh "$cmd" ;;
autoupdate-on) set -- mihomo-kit.sh auto-update on ;; autoupdate-on) set -- mihomo-kit.sh auto-update on ;;
autoupdate-off) set -- mihomo-kit.sh auto-update off ;; autoupdate-off) set -- mihomo-kit.sh auto-update off ;;
mobile-new) set -- mihomo-kit.sh mobile new ;;
*) reply_error "unknown command: $cmd" ;; *) reply_error "unknown command: $cmd" ;;
esac esac
start_job "$@" start_job "$@"
@ -213,6 +217,7 @@ m_config_get() {
json_add_string ts_domains "${TS_DOMAINS:-}" json_add_string ts_domains "${TS_DOMAINS:-}"
json_add_string ovpn_check_url "${OVPN_CHECK_URL:-https://eu.bmstu.ru}" json_add_string ovpn_check_url "${OVPN_CHECK_URL:-https://eu.bmstu.ru}"
json_add_string ts_check_url "${TS_CHECK_URL:-http://100.69.216.50:8080}" json_add_string ts_check_url "${TS_CHECK_URL:-http://100.69.216.50:8080}"
json_add_boolean mobile "${MOBILE:-0}"
json_add_array hy2 json_add_array hy2
for n in ${HY2:-}; do for n in ${HY2:-}; do
k=HY2_$(echo "$n" | tr 'a-z-' 'A-Z_') k=HY2_$(echo "$n" | tr 'a-z-' 'A-Z_')
@ -237,7 +242,7 @@ m_config_set() {
json_select data || reply_error "no data" json_select data || reply_error "no data"
job_running && reply_error "busy: $(cat "$JOB/cmd")" job_running && reply_error "busy: $(cat "$JOB/cmd")"
for v in boot_links hwid_ua hwid_os hwid_os_ver hwid_model hwid_id torrent ru_ips openvpn ovpn \ for v in boot_links hwid_ua hwid_os hwid_os_ver hwid_model hwid_id torrent ru_ips openvpn ovpn \
vpn_username vpn_password totp_secret tailscale ts_hostname ts_domains ovpn_check_url ts_check_url; do vpn_username vpn_password totp_secret tailscale ts_hostname ts_domains ovpn_check_url ts_check_url mobile; do
json_get_var "$v" "$v" "" json_get_var "$v" "$v" ""
done done
if [ -n "$ovpn" ]; then if [ -n "$ovpn" ]; then
@ -284,6 +289,7 @@ m_config_set() {
echo "FORM=1" echo "FORM=1"
echo "OVPN_CHECK_URL=$(q "$ovpn_check_url")" echo "OVPN_CHECK_URL=$(q "$ovpn_check_url")"
echo "TS_CHECK_URL=$(q "$ts_check_url")" echo "TS_CHECK_URL=$(q "$ts_check_url")"
echo "MOBILE=$(q "${mobile:-0}")"
hy2= hy2=
if json_select hy2; then if json_select hy2; then
json_get_keys keys json_get_keys keys

View File

@ -23,6 +23,7 @@
# mihomo-kit.sh fix re-apply core version + fixes (after a nikki upgrade) # mihomo-kit.sh fix re-apply core version + fixes (after a nikki upgrade)
# mihomo-kit.sh ts-login [-f] fresh Tailscale node, print its login URL # mihomo-kit.sh ts-login [-f] fresh Tailscale node, print its login URL
# (-f: also when the node is already logged in) # (-f: also when the node is already logged in)
# mihomo-kit.sh mobile new new secret link for the phone config (MOBILE=1)
# mihomo-kit.sh install packages, core, fixes, links (no questions) # mihomo-kit.sh install packages, core, fixes, links (no questions)
# mihomo-kit.sh render <env>... print the YAML for env file(s) (last wins) # mihomo-kit.sh render <env>... print the YAML for env file(s) (last wins)
@ -90,6 +91,10 @@ compute_tags() {
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 " HY2_MAIN="MY, "
# own servers through MY-EXIT: street (whitelists) and the phone (often on them)
case "$TAGS" in *" hy2 "*" street "* | *" street "*" hy2 "* | *" hy2 "*" mobile "* | *" mobile "*" hy2 "*)
TAGS="$TAGS hy2_exit " ;;
esac
export SUB_LIST HY2_LIST HY2_MAIN export SUB_LIST HY2_LIST HY2_MAIN
} }
@ -472,6 +477,45 @@ cmd_build() {
die "build of $n failed" die "build of $n failed"
fi fi
done done
build_mobile
}
# Phone config (FlClash): with MOBILE=1 in common.env, common.env rendered with
# TARGET=mobile is served by uhttpd as /mihomo-kit/<token>.yaml (subscription
# links inside: the token is the secret, "mobile new" replaces it).
MOBILE_DIR=/www/mihomo-kit
build_mobile() {
if ! grep -q '^MOBILE=1' "$PROFILES_D/common.env" 2>/dev/null || [ ! -d /www ]; then
rm -f "$MOBILE_DIR"/*.yaml
return 0
fi
if [ ! -s "$KIT_DIR/mobile-token" ]; then
(umask 077; head -c 16 /dev/urandom | md5sum | cut -c1-32 > "$KIT_DIR/mobile-token")
fi
_tok=$(cat "$KIT_DIR/mobile-token")
mkdir -p "$MOBILE_DIR"
chmod 755 "$MOBILE_DIR"
# no directory listing of the tokens
[ -f "$MOBILE_DIR/index.html" ] || : > "$MOBILE_DIR/index.html"
echo TARGET=mobile > /tmp/mihomo-kit-mobile.env
if (cmd_render "$PROFILES_D/common.env" /tmp/mihomo-kit-mobile.env) > "$MOBILE_DIR/$_tok.yaml.tmp"; then
for _f in "$MOBILE_DIR"/*.yaml; do
[ "$_f" = "$MOBILE_DIR/$_tok.yaml" ] || rm -f "$_f"
done
mv "$MOBILE_DIR/$_tok.yaml.tmp" "$MOBILE_DIR/$_tok.yaml"
chmod 644 "$MOBILE_DIR/$_tok.yaml"
log "built phone config /mihomo-kit/$_tok.yaml"
else
rm -f "$MOBILE_DIR/$_tok.yaml.tmp"
log "warning: phone config build failed"
fi
rm -f /tmp/mihomo-kit-mobile.env
}
cmd_mobile() {
[ "${1:-}" = new ] || die "usage: mobile new"
rm -f "$KIT_DIR/mobile-token"
build_mobile
} }
cmd_use() { cmd_use() {
@ -654,6 +698,7 @@ install_luci() {
put "$src/acl.json" /usr/share/rpcd/acl.d/luci-app-mihomo-kit.json 644 put "$src/acl.json" /usr/share/rpcd/acl.d/luci-app-mihomo-kit.json 644
# rpcd needs a restart only for its plugin and ACL (it drops LuCI sessions) # rpcd needs a restart only for its plugin and ACL (it drops LuCI sessions)
_rpcd=$_changed _rpcd=$_changed
put "$src/qrcode.js" /www/luci-static/resources/mihomo-kit/qrcode.js 644
_views=/www/luci-static/resources/view _views=/www/luci-static/resources/view
_v=v$(md5sum < "$src/mihomo-kit.js" | cut -c1-8) _v=v$(md5sum < "$src/mihomo-kit.js" | cut -c1-8)
@ -861,7 +906,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_]+|OVPN_CHECK_URL|TS_CHECK_URL" [ "${FORM:-0}" = 1 ] && COMMON_KEYS="$COMMON_KEYS|HY2|HY2_[A-Z0-9_]+|OVPN_CHECK_URL|TS_CHECK_URL|MOBILE"
_others=$(common_other_keys) _others=$(common_other_keys)
sub_pairs sub_pairs
{ {
@ -893,6 +938,7 @@ write_config() {
if [ "${FORM:-0}" = 1 ]; then if [ "${FORM:-0}" = 1 ]; then
[ -n "${OVPN_CHECK_URL:-}" ] && echo "OVPN_CHECK_URL=$(q "$OVPN_CHECK_URL")" [ -n "${OVPN_CHECK_URL:-}" ] && echo "OVPN_CHECK_URL=$(q "$OVPN_CHECK_URL")"
[ -n "${TS_CHECK_URL:-}" ] && echo "TS_CHECK_URL=$(q "$TS_CHECK_URL")" [ -n "${TS_CHECK_URL:-}" ] && echo "TS_CHECK_URL=$(q "$TS_CHECK_URL")"
[ "${MOBILE:-0}" = 1 ] && echo "MOBILE=1"
echo "HY2=$(q "$HY2")" echo "HY2=$(q "$HY2")"
for _n in $HY2; do for _n in $HY2; do
_k=$(hy2_key "$_n") _k=$(hy2_key "$_n")
@ -1124,6 +1170,7 @@ case "${1:-}" in
use) shift; cmd_use "$@" ;; use) shift; cmd_use "$@" ;;
setup) shift; cmd_setup "$@" ;; setup) shift; cmd_setup "$@" ;;
configure) shift; cmd_configure "$@" ;; configure) shift; cmd_configure "$@" ;;
mobile) shift; cmd_mobile "$@" ;;
sub-ids) cmd_sub_ids ;; sub-ids) cmd_sub_ids ;;
update) shift; cmd_update "$@" ;; update) shift; cmd_update "$@" ;;
auto-update) shift; cmd_auto_update "$@" ;; auto-update) shift; cmd_auto_update "$@" ;;
@ -1132,5 +1179,5 @@ case "${1:-}" in
install) cmd_install ;; install) cmd_install ;;
fix) cmd_fix ;; fix) cmd_fix ;;
ts-login) shift; cmd_ts_login "$@" ;; ts-login) shift; cmd_ts_login "$@" ;;
*) sed -n '2,29p' "$SELF" >&2; exit 2 ;; *) sed -n '2,30p' "$SELF" >&2; exit 2 ;;
esac esac

View File

@ -7,13 +7,13 @@
tolerance: 50 tolerance: 50
lazy: false lazy: false
# street: what own servers are reached through; switches only when the node is # street 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) # clearly worse or dead (each switch breaks everything going through MY)
- name: MY-EXIT #@street - name: MY-EXIT #@hy2_exit
type: url-test #@street type: url-test #@hy2_exit
use: [${SUB_LIST}] #@street use: [${SUB_LIST}] #@hy2_exit
exclude-filter: "(?i)🇷🇺|\\bru\\b|russia|росси|моск" #@street exclude-filter: "(?i)🇷🇺|\\bru\\b|russia|росси|моск" #@hy2_exit
url: "https://www.gstatic.com/generate_204" #@street url: "https://www.gstatic.com/generate_204" #@hy2_exit
interval: 300 #@street interval: 300 #@hy2_exit
tolerance: 300 #@street tolerance: 300 #@hy2_exit
lazy: false #@street lazy: false #@hy2_exit

View File

@ -10,4 +10,4 @@
up: "${@@HY2_UP}" up: "${@@HY2_UP}"
down: "${@@HY2_DOWN}" down: "${@@HY2_DOWN}"
udp: true udp: true
dialer-proxy: MY-EXIT #@street dialer-proxy: MY-EXIT #@hy2_exit

View File

@ -1 +1,5 @@
TARGET=mobile TARGET=mobile
HY2=m1
HY2_M1_SERVER=m.example.com
HY2_M1_PORT=443
HY2_M1_PASSWORD=p

View File

@ -195,6 +195,8 @@
if (v.TS_EXIT === "1") t.add("ts_exit"); if (v.TS_EXIT === "1") t.add("ts_exit");
} }
} }
// own servers through MY-EXIT: street (whitelists) and the phone (see compute_tags)
if (t.has("hy2") && (t.has("street") || t.has("mobile"))) t.add("hy2_exit");
return t; return t;
} }

View File

@ -383,6 +383,8 @@
if (v.TS_EXIT === "1") t.add("ts_exit"); if (v.TS_EXIT === "1") t.add("ts_exit");
} }
} }
// own servers through MY-EXIT: street (whitelists) and the phone (see compute_tags)
if (t.has("hy2") && (t.has("street") || t.has("mobile"))) t.add("hy2_exit");
return t; return t;
} }
@ -490,7 +492,7 @@ 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.street.yaml": " # what the OpenVPN tunnel itself goes through on a whitelisted network.\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.street.yaml": " # what the OpenVPN tunnel itself goes through on a whitelisted network.\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\n tolerance: 50\n lazy: false\n\n # street: 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 #@street\n type: url-test #@street\n use: [${SUB_LIST}] #@street\n exclude-filter: \"(?i)🇷🇺|\\\\bru\\\\b|russia|росси|моск\" #@street\n url: \"https://www.gstatic.com/generate_204\" #@street\n interval: 300 #@street\n tolerance: 300 #@street\n lazy: false #@street\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\n tolerance: 50\n lazy: false\n\n # street 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/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/90-base.yaml": " - name: MAIN\n type: select\n proxies: [FOREIGN, ${HY2_MAIN}RU, DIRECT]\n", "groups/90-base.yaml": " - name: MAIN\n type: select\n proxies: [FOREIGN, ${HY2_MAIN}RU, DIRECT]\n",
@ -501,7 +503,7 @@ const TEMPLATES = {
"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: #@street\n dialer-proxy: OVPN-EXIT #@street\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: #@street\n dialer-proxy: OVPN-EXIT #@street\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", "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",
"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", "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",
"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 #@street\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",
"rules/10-tailscale.yaml": " # Tailscale: tailnet IPs and MagicDNS names (resolved by tailscale itself)\n - IP-CIDR,100.64.0.0/10,TAILSCALE,no-resolve\n - DOMAIN-SUFFIX,ts.net,TAILSCALE\n - DOMAIN-SUFFIX,${@TS_DOMAINS},TAILSCALE\n", "rules/10-tailscale.yaml": " # Tailscale: tailnet IPs and MagicDNS names (resolved by tailscale itself)\n - IP-CIDR,100.64.0.0/10,TAILSCALE,no-resolve\n - DOMAIN-SUFFIX,ts.net,TAILSCALE\n - DOMAIN-SUFFIX,${@TS_DOMAINS},TAILSCALE\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 #@home\n - IP-CIDR,${@OVPN_SERVER_IPS}/32,OVPN-EXIT,no-resolve #@street\n - DOMAIN,${OVPN_SERVER_HOST},DIRECT #@home\n - DOMAIN,${OVPN_SERVER_HOST},OVPN-EXIT #@street\n # networks pushed by the server (before the private-range DIRECT rules)\n - IP-CIDR,${@OVPN_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 #@home\n - IP-CIDR,${@OVPN_SERVER_IPS}/32,OVPN-EXIT,no-resolve #@street\n - DOMAIN,${OVPN_SERVER_HOST},DIRECT #@home\n - DOMAIN,${OVPN_SERVER_HOST},OVPN-EXIT #@street\n # networks pushed by the server (before the private-range DIRECT rules)\n - IP-CIDR,${@OVPN_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",