update 2023-03-26 22:43:24
This commit is contained in:
parent
9b77e083c3
commit
f1467d9f3e
|
@ -62,14 +62,5 @@ define Build/Compile
|
|||
)
|
||||
endef
|
||||
|
||||
define Package/adguardhome/install
|
||||
$(call GoPackage/Package/Install/Bin,$(1))
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/adguardhome.init $(1)/etc/init.d/adguardhome
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DATA) ./files/adguardhome.config $(1)/etc/config/adguardhome
|
||||
endef
|
||||
|
||||
$(eval $(call GoBinPackage,adguardhome))
|
||||
$(eval $(call BuildPackage,adguardhome))
|
||||
|
|
|
@ -214,10 +214,14 @@ function parseShareLink(uri, features) {
|
|||
port: url.port || '80',
|
||||
uuid: url.username,
|
||||
transport: params.get('type') !== 'tcp' ? params.get('type') : null,
|
||||
tls: params.get('security') ? '1' : '0',
|
||||
tls: ['tls', 'xtls', 'reality'].includes(params.get('security')) ? '1' : '0',
|
||||
tls_sni: params.get('sni'),
|
||||
tls_alpn: params.get('alpn') ? decodeURIComponent(params.get('alpn')).split(',') : null,
|
||||
tls_utls: features.with_utls ? params.get('fp') : null
|
||||
tls_reality: (params.get('security') === 'reality') ? '1' : '0',
|
||||
tls_reality_public_key: params.get('pbk') ? decodeURIComponent(params.get('pbk')) : null,
|
||||
tls_reality_short_id: params.get('sid'),
|
||||
tls_utls: features.with_utls ? params.get('fp') : null,
|
||||
vless_flow: ['tls', 'reality'].includes(params.get('security')) ? params.get('flow') : null
|
||||
};
|
||||
switch (params.get('type')) {
|
||||
case 'grpc':
|
||||
|
@ -1081,6 +1085,10 @@ return view.extend({
|
|||
let tls_reality = this.map.lookupOption('tls_reality', section_id)[0].formvalue(section_id);
|
||||
if (tls_reality.checked && !value)
|
||||
return _('Expecting: %s').format(_('non-empty value'));
|
||||
|
||||
let vless_flow = this.map.lookupOption('vless_flow', section_id)[0].formvalue(section_id);
|
||||
if ((tls_reality.checked || vless_flow) && ['360', 'android'].includes(value))
|
||||
return _('Unsupported fingerprint!');
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -110,7 +110,7 @@ function parse_uri(uri) {
|
|||
label: http_url.hash ? urldecode(http_url.hash) : null,
|
||||
type: 'http',
|
||||
address: http_url.hostname,
|
||||
port: http_url.port || '80',
|
||||
port: http_url.port,
|
||||
username: http_url.username ? urldecode(http_url.username) : null,
|
||||
password: http_url.password ? urldecode(http_url.password) : null,
|
||||
tls: (uri[0] === 'https') ? '1' : '0'
|
||||
|
@ -159,7 +159,7 @@ function parse_uri(uri) {
|
|||
label: socks_url.hash ? urldecode(socks_url.hash) : null,
|
||||
type: 'socks',
|
||||
address: socks_url.hostname,
|
||||
port: socks_url.port || '80',
|
||||
port: socks_url.port,
|
||||
username: socks_url.username ? urldecode(socks_url.username) : null,
|
||||
password: socks_url.password ? urldecode(socks_url.password) : null,
|
||||
socks_version: (match(uri[0], /4/)) ? '4' : '5'
|
||||
|
@ -282,10 +282,14 @@ function parse_uri(uri) {
|
|||
port: vless_url.port,
|
||||
uuid: vless_url.username,
|
||||
transport: (vless_params.type !== 'tcp') ? vless_params.type : null,
|
||||
tls: vless_params.security ? '1' : '0',
|
||||
tls: (vless_params.security in ['tls', 'xtls', 'reality']) ? '1' : '0',
|
||||
tls_sni: vless_params.sni,
|
||||
tls_alpn: vless_params.alpn ? split(urldecode(vless_params.alpn), ',') : null,
|
||||
tls_utls: sing_features.with_utls ? vless_params.fp : null
|
||||
tls_reality: (vless_params.security === 'reality') ? '1' : '0',
|
||||
tls_reality_public_key: vless_params.pbk ? urldecode(vless_params.pbk) : null,
|
||||
tls_reality_short_id: vless_params.sid,
|
||||
tls_utls: sing_features.with_utls ? vless_params.fp : null,
|
||||
vless_flow: (vless_params.security in ['tls', 'reality']) ? vless_params.flow : null
|
||||
};
|
||||
switch(vless_params.type) {
|
||||
case 'grpc':
|
||||
|
|
|
@ -142,9 +142,18 @@ for k, e in ipairs(api.get_valid_nodes()) do
|
|||
end
|
||||
|
||||
-- 负载均衡列表
|
||||
balancing_node = s:option(DynamicList, "balancing_node", translate("Load balancing node list"), translate("Load balancing node list, <a target='_blank' href='https://toutyrater.github.io/routing/balance2.html'>document</a>"))
|
||||
local balancing_node = s:option(DynamicList, "balancing_node", translate("Load balancing node list"), translate("Load balancing node list, <a target='_blank' href='https://toutyrater.github.io/routing/balance2.html'>document</a>"))
|
||||
for k, v in pairs(nodes_table) do balancing_node:value(v.id, v.remarks) end
|
||||
balancing_node:depends("protocol", "_balancing")
|
||||
local balancingStrategy = s:option(ListValue, "balancingStrategy", translate("Balancing Strategy"))
|
||||
balancingStrategy:depends("protocol", "_balancing")
|
||||
balancingStrategy:value("random")
|
||||
balancingStrategy:value("leastPing")
|
||||
balancingStrategy.default = "random"
|
||||
local probeInterval = s:option(Value, "probeInterval", translate("Probe Interval"))
|
||||
probeInterval:depends("balancingStrategy", "leastPing")
|
||||
probeInterval.default = "1m"
|
||||
probeInterval.description = translate("The interval between initiating probes. Every time this time elapses, a server status check is performed on a server. The time format is numbers + units, such as '10s', '2h45m', and the supported time units are <code>ns</code>, <code>us</code>, <code>ms</code>, <code>s</code>, <code>m</code>, <code>h</code>, which correspond to nanoseconds, microseconds, milliseconds, seconds, minutes, and hours, respectively.")
|
||||
|
||||
-- 分流
|
||||
uci:foreach(appname, "shunt_rules", function(e)
|
||||
|
@ -205,13 +214,11 @@ domainStrategy.description = "<br /><ul><li>" .. translate("'AsIs': Only use dom
|
|||
.. "</li><li>" .. translate("'IPIfNonMatch': When no rule matches current domain, resolves it into IP addresses (A or AAAA records) and try all rules again.")
|
||||
.. "</li><li>" .. translate("'IPOnDemand': As long as there is a IP-based rule, resolves the domain into IP immediately.")
|
||||
.. "</li></ul>"
|
||||
domainStrategy:depends("protocol", "_balancing")
|
||||
domainStrategy:depends("protocol", "_shunt")
|
||||
|
||||
domainMatcher = s:option(ListValue, "domainMatcher", translate("Domain matcher"))
|
||||
domainMatcher:value("hybrid")
|
||||
domainMatcher:value("linear")
|
||||
domainMatcher:depends("protocol", "_balancing")
|
||||
domainMatcher:depends("protocol", "_shunt")
|
||||
|
||||
|
||||
|
|
|
@ -527,6 +527,7 @@ function gen_config(var)
|
|||
local dns = nil
|
||||
local fakedns = nil
|
||||
local routing = nil
|
||||
local observatory = nil
|
||||
local inbounds = {}
|
||||
local outbounds = {}
|
||||
|
||||
|
@ -791,10 +792,18 @@ function gen_config(var)
|
|||
local outbound = gen_outbound(flag, node)
|
||||
if outbound then table.insert(outbounds, outbound) end
|
||||
end
|
||||
if node.balancingStrategy == "leastPing" then
|
||||
observatory = {
|
||||
subjectSelector = nodes,
|
||||
probeInterval = node.probeInterval or "1m"
|
||||
}
|
||||
end
|
||||
routing = {
|
||||
domainStrategy = node.domainStrategy or "AsIs",
|
||||
domainMatcher = node.domainMatcher or "hybrid",
|
||||
balancers = {{tag = "balancer", selector = nodes}},
|
||||
balancers = {{
|
||||
tag = "balancer",
|
||||
selector = nodes,
|
||||
strategy = {type = node.balancingStrategy or "random"}
|
||||
}},
|
||||
rules = {
|
||||
{type = "field", network = "tcp,udp", balancerTag = "balancer"}
|
||||
}
|
||||
|
@ -1039,6 +1048,8 @@ function gen_config(var)
|
|||
inbounds = inbounds,
|
||||
-- 传出连接
|
||||
outbounds = outbounds,
|
||||
-- 连接观测
|
||||
observatory = observatory,
|
||||
-- 路由
|
||||
routing = routing,
|
||||
-- 本地策略
|
||||
|
|
|
@ -226,8 +226,10 @@ local has_xray = api.is_finded("xray")
|
|||
info.path = opt.get("h2_path").value;
|
||||
} else if (v_transport === "tcp") {
|
||||
info.type = opt.get("tcp_guise").value;
|
||||
info.host = opt.get("tcp_guise_http_host").value;
|
||||
info.path = opt.get("tcp_guise_http_path").value;
|
||||
if (info.type === "http") {
|
||||
info.host = opt.get("tcp_guise_http_host").value;
|
||||
info.path = opt.get("tcp_guise_http_path").value;
|
||||
}
|
||||
} else if (v_transport === "mkcp") {
|
||||
v_transport = "kcp";
|
||||
info.type = opt.get("mkcp_guise").value;
|
||||
|
@ -265,6 +267,7 @@ local has_xray = api.is_finded("xray")
|
|||
params += opt.query("host", "ws_host");
|
||||
params += opt.query("path", "ws_path");
|
||||
} else if (v_transport === "h2") {
|
||||
v_transport = "http";
|
||||
params += opt.query("host", "h2_host");
|
||||
params += opt.query("path", "h2_path");
|
||||
} else if (v_transport === "tcp") {
|
||||
|
@ -282,6 +285,7 @@ local has_xray = api.is_finded("xray")
|
|||
//不知道是用path还是serviceName,这里先这样吧
|
||||
params += opt.query("path", "grpc_serviceName");
|
||||
params += opt.query("serviceName", "grpc_serviceName");
|
||||
params += opt.query("mode", "grpc_mode");
|
||||
}
|
||||
params += "&type=" + v_transport;
|
||||
|
||||
|
@ -289,15 +293,25 @@ local has_xray = api.is_finded("xray")
|
|||
|
||||
if (opt.get("tls").checked) {
|
||||
var v_security = "tls";
|
||||
params += "&security=" + v_security;
|
||||
if (opt.get("tlsflow").value) {
|
||||
if (opt.get("xray_fingerprint") && opt.get("xray_fingerprint").value != "") {
|
||||
let v_fp = opt.get("xray_fingerprint").value;
|
||||
params += "&fp=" + v_fp;
|
||||
}
|
||||
if(opt.get("reality") && opt.get("reality").checked) {
|
||||
v_security = "reality";
|
||||
if (opt.get("reality_fingerprint") && opt.get("reality_fingerprint").value != "") {
|
||||
let v_fp = opt.get("reality_fingerprint").value;
|
||||
params += "&fp=" + v_fp;
|
||||
}
|
||||
params += opt.query("pbk", "reality_publicKey");
|
||||
params += opt.query("sid", "reality_shortId");
|
||||
params += opt.query("spx", "reality_spiderX");
|
||||
}
|
||||
if (opt.get("tlsflow") && opt.get("tlsflow").value) {
|
||||
let v_flow = opt.get("tlsflow").value;
|
||||
params += "&flow=" + v_flow;
|
||||
}
|
||||
if (opt.get("xray_fingerprint").value && opt.get("xray_fingerprint").value != "") {
|
||||
let v_fp = opt.get("xray_fingerprint").value
|
||||
params += "&fp=" + v_fp;
|
||||
}
|
||||
params += "&security=" + v_security;
|
||||
params += opt.query("sni", "tls_serverName");
|
||||
}
|
||||
|
||||
|
@ -855,6 +869,7 @@ local has_xray = api.is_finded("xray")
|
|||
if (queryParam.security) {
|
||||
if (queryParam.security == "tls") {
|
||||
opt.set('tls', true);
|
||||
opt.set('reality', false)
|
||||
opt.set('tlsflow', queryParam.flow || '');
|
||||
opt.set('tls_serverName', queryParam.sni || '');
|
||||
opt.set('tls_allowInsecure', true);
|
||||
|
@ -865,11 +880,27 @@ local has_xray = api.is_finded("xray")
|
|||
opt.set('xray_fingerprint', queryParam.fp);
|
||||
}
|
||||
}
|
||||
|
||||
if (queryParam.security == "reality") {
|
||||
opt.set('tls', true);
|
||||
opt.set('reality', true)
|
||||
opt.set('tlsflow', queryParam.flow || '');
|
||||
opt.set('tls_serverName', queryParam.sni || '');
|
||||
if (queryParam.fp && queryParam.fp.trim() != "") {
|
||||
opt.set('reality_fingerprint', queryParam.fp);
|
||||
}
|
||||
opt.set('reality_publicKey', queryParam.pbk || '');
|
||||
opt.set('reality_shortId', queryParam.sid || '');
|
||||
opt.set('reality_spiderX', queryParam.spx || '');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
queryParam.type = queryParam.type.toLowerCase();
|
||||
if (queryParam.type === "kcp" || queryParam.type === "mkcp")
|
||||
queryParam.type = "mkcp"
|
||||
if (queryParam.type === "h2" || queryParam.type === "http")
|
||||
queryParam.type = "h2"
|
||||
opt.set('transport', queryParam.type);
|
||||
if (queryParam.type === "tcp") {
|
||||
opt.set('tcp_guise', queryParam.headerType || "none");
|
||||
|
@ -880,7 +911,7 @@ local has_xray = api.is_finded("xray")
|
|||
} else if (queryParam.type === "ws") {
|
||||
opt.set('ws_host', queryParam.host || "");
|
||||
opt.set('ws_path', queryParam.path || "");
|
||||
} else if (queryParam.type === "h2") {
|
||||
} else if (queryParam.type === "h2" || queryParam.type === "http") {
|
||||
opt.set('h2_host', queryParam.host || "");
|
||||
opt.set('h2_path', queryParam.path || "");
|
||||
} else if (queryParam.type === "quic") {
|
||||
|
@ -891,6 +922,7 @@ local has_xray = api.is_finded("xray")
|
|||
opt.set('mkcp_guise', queryParam.headerType || "none");
|
||||
} else if (queryParam.type === "grpc") {
|
||||
opt.set('grpc_serviceName', (queryParam.serviceName || queryParam.path) || "");
|
||||
opt.set('grpc_mode', queryParam.mode);
|
||||
}
|
||||
|
||||
if (m.hash) {
|
||||
|
|
|
@ -346,6 +346,15 @@ msgstr "Xray 负载均衡"
|
|||
msgid "V2ray_balancing"
|
||||
msgstr "V2ray 负载均衡"
|
||||
|
||||
msgid "Balancing Strategy"
|
||||
msgstr "负载均衡策略"
|
||||
|
||||
msgid "Probe Interval"
|
||||
msgstr "探测间隔"
|
||||
|
||||
msgid "The interval between initiating probes. Every time this time elapses, a server status check is performed on a server. The time format is numbers + units, such as '10s', '2h45m', and the supported time units are <code>ns</code>, <code>us</code>, <code>ms</code>, <code>s</code>, <code>m</code>, <code>h</code>, which correspond to nanoseconds, microseconds, milliseconds, seconds, minutes, and hours, respectively."
|
||||
msgstr "发起探测的间隔。每经过这个时间,就会对一个服务器进行服务器状态检测。时间格式为数字+单位,比如<code>"10s"</code>, <code>"2h45m"</code>,支持的时间单位有 <code>ns</code>,<code>us</code>,<code>ms</code>,<code>s</code>,<code>m</code>,<code>h</code>,分别对应纳秒、微秒、毫秒、秒、分、时。"
|
||||
|
||||
msgid "Shunt"
|
||||
msgstr "分流"
|
||||
|
||||
|
|
|
@ -737,7 +737,8 @@ local function processData(szType, content, add_mode, add_from)
|
|||
result.ws_host = params.host
|
||||
result.ws_path = params.path
|
||||
end
|
||||
if params.type == 'h2' then
|
||||
if params.type == 'h2' or params.type == 'http' then
|
||||
params.type = "h2"
|
||||
result.h2_host = params.host
|
||||
result.h2_path = params.path
|
||||
end
|
||||
|
@ -765,17 +766,24 @@ local function processData(szType, content, add_mode, add_from)
|
|||
if params.type == 'grpc' then
|
||||
if params.path then result.grpc_serviceName = params.path end
|
||||
if params.serviceName then result.grpc_serviceName = params.serviceName end
|
||||
result.grpc_mode = params.mode
|
||||
end
|
||||
result.transport = params.type
|
||||
|
||||
result.encryption = params.encryption or "none"
|
||||
|
||||
result.tls = "0"
|
||||
if params.security == "tls" then
|
||||
if params.security == "tls" or params.security == "reality" then
|
||||
result.tls = "1"
|
||||
result.tlsflow = params.flow or nil
|
||||
result.tls_serverName = (params.sni and params.sni ~= "") and params.sni or params.host
|
||||
result.fingerprint = (params.fp and params.fp ~= "") and params.fp or "chrome"
|
||||
if params.security == "reality" then
|
||||
result.reality = "1"
|
||||
result.reality_publicKey = params.pbk or nil
|
||||
result.reality_shortId = params.sid or nil
|
||||
result.reality_spiderX = params.spx or nil
|
||||
end
|
||||
end
|
||||
|
||||
result.port = port
|
||||
|
|
Loading…
Reference in New Issue