mirror of
https://github.com/bolucat/Archive.git
synced 2025-12-24 13:28:37 +08:00
Update On Tue Dec 23 19:42:16 CET 2025
This commit is contained in:
@@ -111,6 +111,10 @@ o:depends({ [_n("protocol")] = "_balancing" })
|
||||
o.widget = "checkbox"
|
||||
o.template = appname .. "/cbi/nodes_multivalue"
|
||||
o.group = {}
|
||||
for k, v in pairs(socks_list) do
|
||||
o:value(v.id, v.remark)
|
||||
o.group[#o.group+1] = v.group or ""
|
||||
end
|
||||
for i, v in pairs(nodes_table) do
|
||||
o:value(v.id, v.remark)
|
||||
o.group[#o.group+1] = v.group or ""
|
||||
@@ -166,6 +170,10 @@ end
|
||||
if is_balancer then
|
||||
check_fallback_chain(arg[1])
|
||||
end
|
||||
for k, v in pairs(socks_list) do
|
||||
o:value(v.id, v.remark)
|
||||
o.group[#o.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
|
||||
end
|
||||
for k, v in pairs(fallback_table) do
|
||||
o:value(v.id, v.remark)
|
||||
o.group[#o.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
|
||||
@@ -723,6 +731,9 @@ o = s:option(Value, _n("xudp_concurrency"), translate("XUDP Mux concurrency"))
|
||||
o.default = 8
|
||||
o:depends({ [_n("mux")] = true })
|
||||
|
||||
o = s:option(Flag, _n("tcp_fast_open"), "TCP " .. translate("Fast Open"))
|
||||
o.default = 0
|
||||
|
||||
--[[tcpMptcp]]
|
||||
o = s:option(Flag, _n("tcpMptcp"), "tcpMptcp", translate("Enable Multipath TCP, need to be enabled in both server and client configuration."))
|
||||
o.default = 0
|
||||
|
||||
@@ -120,6 +120,10 @@ o:depends({ [_n("protocol")] = "_urltest" })
|
||||
o.widget = "checkbox"
|
||||
o.template = appname .. "/cbi/nodes_multivalue"
|
||||
o.group = {}
|
||||
for k, v in pairs(socks_list) do
|
||||
o:value(v.id, v.remark)
|
||||
o.group[#o.group+1] = v.group or ""
|
||||
end
|
||||
for i, v in pairs(nodes_table) do
|
||||
o:value(v.id, v.remark)
|
||||
o.group[#o.group+1] = v.group or ""
|
||||
|
||||
@@ -46,7 +46,7 @@ function gen_outbound(flag, node, tag, proxy_table)
|
||||
local relay_port = node.port
|
||||
new_port = get_new_port()
|
||||
local config_file = string.format("%s_%s_%s.json", flag, tag, new_port)
|
||||
if tag and node_id and tag ~= node_id then
|
||||
if tag and node_id and not tag:find(node_id) then
|
||||
config_file = string.format("%s_%s_%s_%s.json", flag, tag, node_id, new_port)
|
||||
end
|
||||
if run_socks_instance then
|
||||
@@ -1064,12 +1064,30 @@ function gen_config(var)
|
||||
end
|
||||
end
|
||||
if is_new_ut_node then
|
||||
local ut_node = uci:get_all(appname, ut_node_id)
|
||||
local outbound = gen_outbound(flag, ut_node, ut_node_tag, { fragment = singbox_settings.fragment == "1" or nil, record_fragment = singbox_settings.record_fragment == "1" or nil, run_socks_instance = not no_run })
|
||||
if outbound then
|
||||
outbound.tag = outbound.tag .. ":" .. ut_node.remarks
|
||||
table.insert(outbounds, outbound)
|
||||
valid_nodes[#valid_nodes + 1] = outbound.tag
|
||||
local ut_node
|
||||
if ut_node_id:find("Socks_") then
|
||||
local socks_id = ut_node_id:sub(1 + #"Socks_")
|
||||
local socks_node = uci:get_all(appname, socks_id) or nil
|
||||
if socks_node then
|
||||
ut_node = {
|
||||
type = "sing-box",
|
||||
protocol = "socks",
|
||||
address = "127.0.0.1",
|
||||
port = socks_node.port,
|
||||
uot = "1",
|
||||
remarks = "Socks_" .. socks_node.port
|
||||
}
|
||||
end
|
||||
else
|
||||
ut_node = uci:get_all(appname, ut_node_id)
|
||||
end
|
||||
if ut_node then
|
||||
local outbound = gen_outbound(flag, ut_node, ut_node_tag, { fragment = singbox_settings.fragment == "1" or nil, record_fragment = singbox_settings.record_fragment == "1" or nil, run_socks_instance = not no_run })
|
||||
if outbound then
|
||||
outbound.tag = outbound.tag .. ":" .. ut_node.remarks
|
||||
table.insert(outbounds, outbound)
|
||||
valid_nodes[#valid_nodes + 1] = outbound.tag
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -71,7 +71,7 @@ function gen_outbound(flag, node, tag, proxy_table)
|
||||
local relay_port = node.port
|
||||
new_port = get_new_port()
|
||||
local config_file = string.format("%s_%s_%s.json", flag, tag, new_port)
|
||||
if tag and node_id and tag ~= node_id then
|
||||
if tag and node_id and not tag:find(node_id) then
|
||||
config_file = string.format("%s_%s_%s_%s.json", flag, tag, node_id, new_port)
|
||||
end
|
||||
if run_socks_instance then
|
||||
@@ -142,6 +142,7 @@ function gen_outbound(flag, node, tag, proxy_table)
|
||||
streamSettings = (node.streamSettings or node.protocol == "vmess" or node.protocol == "vless" or node.protocol == "socks" or node.protocol == "shadowsocks" or node.protocol == "trojan") and {
|
||||
sockopt = {
|
||||
mark = 255,
|
||||
tcpFastOpen = (node.tcp_fast_open == "1") and true or nil,
|
||||
tcpMptcp = (node.tcpMptcp == "1") and true or nil,
|
||||
dialerProxy = (fragment or noise) and "dialerproxy" or nil
|
||||
},
|
||||
@@ -741,12 +742,31 @@ function gen_config(var)
|
||||
end
|
||||
end
|
||||
if is_new_blc_node then
|
||||
local blc_node = uci:get_all(appname, blc_node_id)
|
||||
local outbound = gen_outbound(flag, blc_node, blc_node_tag, { fragment = xray_settings.fragment == "1" or nil, noise = xray_settings.noise == "1" or nil, run_socks_instance = not no_run })
|
||||
if outbound then
|
||||
outbound.tag = outbound.tag .. ":" .. blc_node.remarks
|
||||
table.insert(outbounds, outbound)
|
||||
valid_nodes[#valid_nodes + 1] = outbound.tag
|
||||
local blc_node
|
||||
if blc_node_id:find("Socks_") then
|
||||
local socks_id = blc_node_id:sub(1 + #"Socks_")
|
||||
local socks_node = uci:get_all(appname, socks_id) or nil
|
||||
if socks_node then
|
||||
blc_node = {
|
||||
type = "Xray",
|
||||
protocol = "socks",
|
||||
address = "127.0.0.1",
|
||||
port = socks_node.port,
|
||||
transport = "tcp",
|
||||
stream_security = "none",
|
||||
remarks = "Socks_" .. socks_node.port
|
||||
}
|
||||
end
|
||||
else
|
||||
blc_node = uci:get_all(appname, blc_node_id)
|
||||
end
|
||||
if blc_node then
|
||||
local outbound = gen_outbound(flag, blc_node, blc_node_tag, { fragment = xray_settings.fragment == "1" or nil, noise = xray_settings.noise == "1" or nil, run_socks_instance = not no_run })
|
||||
if outbound then
|
||||
outbound.tag = outbound.tag .. ":" .. blc_node.remarks
|
||||
table.insert(outbounds, outbound)
|
||||
valid_nodes[#valid_nodes + 1] = outbound.tag
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -766,17 +786,36 @@ function gen_config(var)
|
||||
end
|
||||
end
|
||||
if is_new_node then
|
||||
local fallback_node = uci:get_all(appname, fallback_node_id)
|
||||
if fallback_node.protocol ~= "_balancing" then
|
||||
local outbound = gen_outbound(flag, fallback_node, fallback_node_id, { fragment = xray_settings.fragment == "1" or nil, noise = xray_settings.noise == "1" or nil, run_socks_instance = not no_run })
|
||||
if outbound then
|
||||
outbound.tag = outbound.tag .. ":" .. fallback_node.remarks
|
||||
table.insert(outbounds, outbound)
|
||||
fallback_node_tag = outbound.tag
|
||||
local fallback_node
|
||||
if fallback_node_id:find("Socks_") then
|
||||
local socks_id = fallback_node_id:sub(1 + #"Socks_")
|
||||
local socks_node = uci:get_all(appname, socks_id) or nil
|
||||
if socks_node then
|
||||
fallback_node = {
|
||||
type = "Xray",
|
||||
protocol = "socks",
|
||||
address = "127.0.0.1",
|
||||
port = socks_node.port,
|
||||
transport = "tcp",
|
||||
stream_security = "none",
|
||||
remarks = "Socks_" .. socks_node.port
|
||||
}
|
||||
end
|
||||
else
|
||||
if gen_balancer(fallback_node) then
|
||||
fallback_node_tag = fallback_node_id
|
||||
fallback_node = uci:get_all(appname, fallback_node_id)
|
||||
end
|
||||
if fallback_node then
|
||||
if fallback_node.protocol ~= "_balancing" then
|
||||
local outbound = gen_outbound(flag, fallback_node, fallback_node_id, { fragment = xray_settings.fragment == "1" or nil, noise = xray_settings.noise == "1" or nil, run_socks_instance = not no_run })
|
||||
if outbound then
|
||||
outbound.tag = outbound.tag .. ":" .. fallback_node.remarks
|
||||
table.insert(outbounds, outbound)
|
||||
fallback_node_tag = outbound.tag
|
||||
end
|
||||
else
|
||||
if gen_balancer(fallback_node) then
|
||||
fallback_node_tag = fallback_node_id
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1604,7 +1643,11 @@ function gen_config(var)
|
||||
end
|
||||
|
||||
for index, value in ipairs(config.outbounds) do
|
||||
if not value["_flag_proxy_tag"] and value["_id"] and value.server and value.server_port and not no_run then
|
||||
local s = value.settings
|
||||
if not value["_flag_proxy_tag"] and value["_id"] and s and not no_run and
|
||||
((s.vnext and s.vnext[1] and s.vnext[1].address and s.vnext[1].port) or
|
||||
(s.servers and s.servers[1] and s.servers[1].address and s.servers[1].port) or
|
||||
(s.peers and s.peers[1] and s.peers[1].endpoint)) then
|
||||
sys.call(string.format("echo '%s' >> %s", value["_id"], api.TMP_PATH .. "/direct_node_list"))
|
||||
end
|
||||
for k, v in pairs(config.outbounds[index]) do
|
||||
|
||||
@@ -36,59 +36,46 @@ local api = require "luci.passwall2.api"
|
||||
|
||||
|
||||
var global_id = null;
|
||||
var global = document.getElementById("cbi-passwall2-global");
|
||||
var global = document.getElementById("cbi-<%=api.appname%>-global");
|
||||
if (global) {
|
||||
var node = global.getElementsByClassName("cbi-section-node")[0];
|
||||
var node_id = node.getAttribute("id");
|
||||
global_id = node_id;
|
||||
var reg1 = new RegExp("(?<=" + node_id + "-).*?(?=(_node))");
|
||||
var all_node = node.querySelectorAll("[id]");
|
||||
var reg1 = /^cbid\..*node\.main$/;
|
||||
|
||||
for (var i = 0; i < node.childNodes.length; i++) {
|
||||
var row = node.childNodes[i];
|
||||
if (!row || !row.childNodes) continue;
|
||||
for (var i = 0; i < all_node.length; i++) {
|
||||
var el = all_node[i];
|
||||
if (!reg1.test(el.id)) continue;
|
||||
|
||||
for (var k = 0; k < row.childNodes.length; k++) {
|
||||
try {
|
||||
var dom = row.childNodes[k];
|
||||
if (!dom || !dom.id) continue;
|
||||
var s = dom.id.match(reg1);
|
||||
if (!s) continue;
|
||||
var cbi_id = global_id + "-";
|
||||
var cbid = dom.id.split(cbi_id).join(cbi_id.split("-").join(".")).split("cbi.").join("cbid.");
|
||||
var dom_id = cbid + ".main";
|
||||
if (!/_node\.main$/.test(dom_id)) continue;
|
||||
|
||||
var node_select = document.getElementById(dom_id);
|
||||
if (!node_select) continue;
|
||||
|
||||
var hidden_select = document.getElementById(cbid);
|
||||
var node_select_value = hidden_select ? hidden_select.options[0].value : "";
|
||||
if (!node_select_value || node_select_value.indexOf("_default") === 0 || node_select_value.indexOf("_direct") === 0 || node_select_value.indexOf("_blackhole") === 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var to_url = '<%=api.url("node_config")%>/' + node_select_value;
|
||||
if (node_select_value.indexOf("Socks_") === 0) {
|
||||
to_url = '<%=api.url("socks_config")%>/' +
|
||||
node_select_value.substring("Socks_".length);
|
||||
}
|
||||
var html = '<a href="#" onclick="location.href=\'' + to_url + '\'"><%:Edit%></a>';
|
||||
|
||||
if (s[0] === "tcp" || s[0] === "udp") {
|
||||
html += '<a href="#" onclick="window.open(\'' + '<%=api.url("get_redir_log")%>?name=default&proto=' + s[0] + '\', \'_blank\')"><%:Log%></a>';
|
||||
}
|
||||
|
||||
node_select.insertAdjacentHTML("beforeend",
|
||||
'<div class="node-actions" style="display:inline-flex; align-items:center; gap:4px; flex-wrap:wrap; margin-left:4px;">'
|
||||
+ html + '</div>'
|
||||
);
|
||||
} catch (e) {
|
||||
}
|
||||
var node_select = el;
|
||||
if (!node_select) continue;
|
||||
var cbid = el.id.replace(/\.main$/, "");
|
||||
var hidden_select = document.getElementById(cbid);
|
||||
var node_select_value = hidden_select ? hidden_select.options[0].value : "";
|
||||
if (!node_select_value || node_select_value.indexOf("_default") === 0 || node_select_value.indexOf("_direct") === 0 || node_select_value.indexOf("_blackhole") === 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var to_url = '<%=api.url("node_config")%>/' + node_select_value;
|
||||
if (node_select_value.indexOf("Socks_") === 0) {
|
||||
to_url = '<%=api.url("socks_config")%>/' + node_select_value.substring("Socks_".length);
|
||||
}
|
||||
var html = '<a href="#" onclick="location.href=\'' + to_url + '\'"><%:Edit%></a>';
|
||||
|
||||
var m = cbid.match(/\.node$/);
|
||||
if (m) {
|
||||
html += '<a href="#" onclick="window.open(\'' + '<%=api.url("get_redir_log")%>?id=default&name=' + 'global' + '\', \'_blank\')"><%:Log%></a>';
|
||||
}
|
||||
|
||||
node_select.insertAdjacentHTML("beforeend",
|
||||
'<div class="node-actions" style="display:inline-flex; align-items:center; gap:4px; flex-wrap:wrap; margin-left:4px;">'
|
||||
+ html + '</div>'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
var socks = document.getElementById("cbi-passwall2-socks");
|
||||
var socks = document.getElementById("cbi-<%=api.appname%>-socks");
|
||||
if (socks) {
|
||||
var socks_enabled_dom = document.getElementById(global_id + "-socks_enabled");
|
||||
socks_enabled_dom.parentNode.removeChild(socks_enabled_dom);
|
||||
|
||||
@@ -255,8 +255,11 @@ check_depends() {
|
||||
}
|
||||
|
||||
first_type() {
|
||||
local path_name=${1}
|
||||
type -t -p "/bin/${path_name}" -p "${TMP_BIN_PATH}/${path_name}" -p "${path_name}" "$@" | head -n1
|
||||
[ "${1#/}" != "$1" ] && [ -x "$1" ] && echo "$1" && return
|
||||
for p in "/bin/$1" "/usr/bin/$1" "${TMP_BIN_PATH:-/tmp}/$1"; do
|
||||
[ -x "$p" ] && echo "$p" && return
|
||||
done
|
||||
command -v "$1" 2>/dev/null || command -v "$2" 2>/dev/null
|
||||
}
|
||||
|
||||
eval_set_val() {
|
||||
|
||||
Reference in New Issue
Block a user