Added input option to my servers from sub
This commit is contained in:
parent
d030d7e23c
commit
edfcb7f82f
@ -429,6 +429,15 @@ mihomo разбирает подписку (`luci/servers.js` — перенос
|
|||||||
«Настройки (YAML)», становится тем же «Входом». Пул, в который сервер входит сам, как вход
|
«Настройки (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]` … или файл — тогда сервер называется по имени файла). Получается сервер
|
||||||
|
|||||||
@ -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: { '': {} } });
|
||||||
|
|
||||||
@ -848,6 +849,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;
|
||||||
@ -1093,6 +1137,17 @@ return view.extend({
|
|||||||
errors.push('Свой сервер ' + n + ': вход через пул ' + en + ', в который он сам входит — так нельзя');
|
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;
|
||||||
@ -1133,7 +1188,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) {
|
||||||
@ -1244,7 +1300,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' }, [
|
||||||
|
|||||||
16
luci/rpcd.sh
16
luci/rpcd.sh
@ -293,6 +293,15 @@ 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:-}"
|
||||||
|
# [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 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
|
hostlist_files
|
||||||
@ -421,7 +430,12 @@ 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 _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 ""
|
||||||
|
|||||||
@ -183,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
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -363,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
|
||||||
@ -378,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,
|
||||||
@ -425,6 +429,68 @@ own_servers_vars() {
|
|||||||
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
|
# 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)
|
# or a pool that does not hold the server itself (that would be a loop)
|
||||||
own_entries_check() {
|
own_entries_check() {
|
||||||
@ -437,6 +503,14 @@ own_entries_check() {
|
|||||||
printf '%s\n' "$POOL_JSON" | grep -qxF "$_on" && die "own server $_on: its entry is the pool $_oe that holds it (a loop)"
|
printf '%s\n' "$POOL_JSON" | grep -qxF "$_on" && die "own server $_on: its entry is the pool $_oe that holds it (a loop)"
|
||||||
true
|
true
|
||||||
done || exit 1
|
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
|
||||||
@ -489,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
|
||||||
@ -558,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
|
||||||
@ -891,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"
|
||||||
@ -979,6 +1061,7 @@ 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
|
own_entries_check
|
||||||
@ -2196,7 +2279,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|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
|
||||||
{
|
{
|
||||||
@ -2242,6 +2325,9 @@ write_config() {
|
|||||||
[ -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 "${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")
|
||||||
@ -2310,8 +2396,9 @@ 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 and [MY] node entries unless the form sends them
|
||||||
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:-}
|
||||||
|
|||||||
@ -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
|
||||||
@ -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: http
|
type: http
|
||||||
url: "https://sub.example.com/sub/aaa"
|
url: "https://sub.example.com/sub/aaa"
|
||||||
@ -97,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"
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -81,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
|
||||||
@ -100,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
|
||||||
|
|||||||
@ -80,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
|
||||||
@ -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).
|
||||||
example2-my:
|
example2-my:
|
||||||
type: file
|
type: file
|
||||||
path: ./providers/example2.yaml
|
path: ./providers/example2.yaml
|
||||||
|
|||||||
@ -75,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
|
||||||
@ -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
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -72,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
|
||||||
@ -91,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
|
||||||
|
|||||||
@ -80,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 +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
|
||||||
|
|||||||
@ -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
|
||||||
@ -98,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
|
||||||
@ -117,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
|
||||||
|
|||||||
@ -80,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
|
||||||
@ -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).
|
||||||
example2-my:
|
example2-my:
|
||||||
type: file
|
type: file
|
||||||
path: ./providers/example2.yaml
|
path: ./providers/example2.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
|
||||||
|
|||||||
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'
|
||||||
Loading…
Reference in New Issue
Block a user