mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-09-10 18:34:18 +08:00
⛅ Sync 2026-06-10 21:12:18
This commit is contained in:
@@ -121,18 +121,7 @@ function parse_filter(cfg) {
|
||||
return cfg;
|
||||
}
|
||||
|
||||
function get_proxynode(cfg) {
|
||||
if (isEmpty(cfg))
|
||||
return null;
|
||||
|
||||
const label = uci.get(uciconf, cfg, 'label');
|
||||
if (isEmpty(label))
|
||||
die(sprintf("%s's label is missing, please check your configuration.", cfg));
|
||||
else
|
||||
return label;
|
||||
}
|
||||
|
||||
function get_proxygroup(cfg) {
|
||||
function get_proxy(cfg) {
|
||||
if (isEmpty(cfg))
|
||||
return null;
|
||||
|
||||
@@ -164,7 +153,7 @@ function get_nameserver(cfg, detour) {
|
||||
});
|
||||
} else
|
||||
push(servers, replace(dnsservers[k]?.address || '', /#detour=([^&]+)/, (m, c1) => {
|
||||
return '#' + urlencode(get_proxygroup(detour || c1));
|
||||
return '#' + urlencode(get_proxy(detour || c1));
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -177,7 +166,7 @@ function parse_entry(cfg) {
|
||||
|
||||
let rule = json(cfg);
|
||||
if (rule.detour)
|
||||
rule.detour = get_proxygroup(rule.detour);
|
||||
rule.detour = get_proxy(rule.detour);
|
||||
|
||||
function _payloadStrategy(payload) {
|
||||
// LOGIC_TYPE,((payload1),(payload2))
|
||||
@@ -225,7 +214,7 @@ uci.foreach(uciconf, ucichain, (cfg) => {
|
||||
return;
|
||||
|
||||
dialerproxy[identifier] = {
|
||||
detour: get_proxygroup(cfg.chain_tail_group) || get_proxynode(cfg.chain_tail)
|
||||
detour: get_proxy(cfg.chain_tail_group) || get_proxy(cfg.chain_tail)
|
||||
};
|
||||
});
|
||||
|
||||
@@ -349,7 +338,7 @@ uci.foreach(uciconf, uciinbd, (cfg) => {
|
||||
if (cfg.enabled === '0')
|
||||
return;
|
||||
|
||||
push(config.listeners, parseListener(cfg, true, get_proxygroup(cfg.proxy)));
|
||||
push(config.listeners, parseListener(cfg, true, get_proxy(cfg.proxy)));
|
||||
});
|
||||
/* Tun settings */
|
||||
if (match(proxy_mode, /tun/))
|
||||
@@ -738,14 +727,14 @@ uci.foreach(uciconf, ucipgrp, (cfg) => {
|
||||
name: cfg.label,
|
||||
type: cfg.type,
|
||||
proxies: [
|
||||
...map(cfg.groups || [], cfg => get_proxygroup(cfg)),
|
||||
...map(cfg.proxies || [], cfg => get_proxynode(cfg))
|
||||
...map(cfg.groups || [], cfg => get_proxy(cfg)),
|
||||
...map(cfg.proxies || [], cfg => get_proxy(cfg))
|
||||
],
|
||||
use: cfg.use,
|
||||
"include-all": strToBool(cfg.include_all),
|
||||
"include-all-proxies": strToBool(cfg.include_all_proxies),
|
||||
"include-all-providers": strToBool(cfg.include_all_providers),
|
||||
"empty-fallback": cfg.empty_fallback ? get_proxygroup(cfg.empty_fallback) : null,
|
||||
"empty-fallback": cfg.empty_fallback ? get_proxy(cfg.empty_fallback) : null,
|
||||
// Url-test fields
|
||||
tolerance: (cfg.type === 'url-test') ? strToInt(cfg.tolerance) ?? 150 : null,
|
||||
// Load-balance fields
|
||||
@@ -786,7 +775,8 @@ uci.foreach(uciconf, uciprov, (cfg) => {
|
||||
url: cfg.url,
|
||||
"size-limit": bytesizeToByte(cfg.size_limit) || null,
|
||||
interval: (cfg.type === 'http') ? durationToSecond(cfg.interval) ?? 86400 : null,
|
||||
proxy: get_proxygroup(cfg.proxy),
|
||||
proxy: get_proxy(cfg.proxy),
|
||||
"age-secret-key": cfg.age_private_key,
|
||||
header: cfg.header ? json(cfg.header) : null,
|
||||
/* Health fields */
|
||||
"health-check": cfg.health_enable === '0' ? {enable: false} : {
|
||||
@@ -843,7 +833,7 @@ uci.foreach(uciconf, ucirule, (cfg) => {
|
||||
"path-in-bundle": cfg.path_in_bundle,
|
||||
"size-limit": bytesizeToByte(cfg.size_limit) || null,
|
||||
interval: (cfg.type === 'http') ? durationToSecond(cfg.interval) ?? 259200 : null,
|
||||
proxy: get_proxygroup(cfg.proxy),
|
||||
proxy: get_proxy(cfg.proxy),
|
||||
header: cfg.header ? json(cfg.header) : null
|
||||
})
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user