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:
@@ -730,6 +730,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
|
||||
|
||||
@@ -95,7 +95,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
|
||||
|
||||
@@ -74,7 +74,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
|
||||
@@ -146,6 +146,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
|
||||
},
|
||||
|
||||
@@ -35,59 +35,46 @@ local api = require "luci.passwall.api"
|
||||
}
|
||||
|
||||
var global_id = null;
|
||||
var global = document.getElementById("cbi-passwall-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(/\.(tcp|udp)_node$/);
|
||||
if (m && (m[1] === "tcp" || m[1] === "udp")) {
|
||||
html += '<a href="#" onclick="window.open(\'' + '<%=api.url("get_redir_log")%>?name=default&proto=' + m[1] + '\', \'_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-passwall-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);
|
||||
|
||||
@@ -254,7 +254,8 @@ check_ver() {
|
||||
}
|
||||
|
||||
first_type() {
|
||||
for p in "/bin/$1" "${TMP_BIN_PATH:-/tmp}/$1" "$1"; do
|
||||
[ "${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
|
||||
@@ -690,7 +691,7 @@ run_socks() {
|
||||
|
||||
case "$type" in
|
||||
socks)
|
||||
local _socks_address _socks_port _socks_username _socks_password
|
||||
local _socks_address _socks_port _socks_username _socks_password _extra_param microsocks_fwd
|
||||
if [ "$node2socks_port" = "0" ]; then
|
||||
_socks_address=$(config_n_get $node address)
|
||||
_socks_port=$(config_n_get $node port)
|
||||
@@ -700,13 +701,24 @@ run_socks() {
|
||||
_socks_address="127.0.0.1"
|
||||
_socks_port=$node2socks_port
|
||||
fi
|
||||
[ "$http_port" != "0" ] && {
|
||||
if [ "$http_port" != "0" ]; then
|
||||
http_flag=1
|
||||
config_file="${config_file//SOCKS/HTTP_SOCKS}"
|
||||
local _extra_param="-local_http_address $bind -local_http_port $http_port"
|
||||
}
|
||||
_extra_param="-local_http_address $bind -local_http_port $http_port"
|
||||
else
|
||||
# 仅 passwall-packages 专用的 microsocks 才支持 socks 转发规则!
|
||||
microsocks_fwd="$($(first_type microsocks) -V 2>/dev/null | grep -i forward)"
|
||||
fi
|
||||
local bin=$(first_type $(config_t_get global_app sing_box_file) sing-box)
|
||||
if [ -n "$bin" ]; then
|
||||
if [ -n "$microsocks_fwd" ]; then
|
||||
local ext_name=$(echo "$config_file" | sed "s|^${TMP_PATH}/||; s|\.json\$||; s|/|_|g")
|
||||
if [ -n "$_socks_username" ] && [ -n "$_socks_password" ]; then
|
||||
_extra_param="-f \"0.0.0.0:0,${_socks_username}:${_socks_password}@${_socks_address}:${_socks_port},0.0.0.0:0\""
|
||||
else
|
||||
_extra_param="-f \"0.0.0.0:0,${_socks_address}:${_socks_port},0.0.0.0:0\""
|
||||
fi
|
||||
ln_run "$(first_type microsocks)" "microsocks_${ext_name}" $log_file -i $bind -p $socks_port ${_extra_param}
|
||||
elif [ -n "$bin" ]; then
|
||||
type="sing-box"
|
||||
lua $UTIL_SINGBOX gen_proto_config -local_socks_address $bind -local_socks_port $socks_port ${_extra_param} -server_proto socks -server_address ${_socks_address} -server_port ${_socks_port} -server_username ${_socks_username} -server_password ${_socks_password} > $config_file
|
||||
ln_run "$bin" ${type} $log_file run -c "$config_file"
|
||||
|
||||
Reference in New Issue
Block a user