mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-16 21:43:33 +08:00
🛸 Sync 2026-08-19 20:38:21
This commit is contained in:
1 parent
7549efdb5e
commit
7cb3d8fcff
55 files changed
+403
-252
No files matched your search
@@ -7,8 +7,8 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-passwall
|
||||
PKG_VERSION:=26.8.12
|
||||
PKG_RELEASE:=229
|
||||
PKG_VERSION:=26.8.19
|
||||
PKG_RELEASE:=230
|
||||
PKG_PO_VERSION:=$(PKG_VERSION)
|
||||
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
|
||||
@@ -466,12 +466,12 @@ function socks_status()
|
||||
local index = http.formvalue("index")
|
||||
local id = http.formvalue("id")
|
||||
e.index = index
|
||||
e.socks_status = luci.sys.call(string.format("/bin/busybox top -bn1 | grep -v -E 'grep|acl/|acl_' | grep '%s/bin/' | grep '%s' > /dev/null", appname, id)) == 0
|
||||
e.socks_status = luci.sys.call(string.format("/bin/busybox top -bn1 | grep -v -E 'grep|acl/|acl_' | grep '%s/bin/' | grep '/%s' > /dev/null", appname, id)) == 0
|
||||
local use_http = uci_get(id, "http_port") or 0
|
||||
e.use_http = 0
|
||||
if tonumber(use_http) > 0 then
|
||||
e.use_http = 1
|
||||
e.http_status = luci.sys.call(string.format("/bin/busybox top -bn1 | grep -v -E 'grep|acl/|acl_' | grep '%s/bin/' | grep '%s' | grep -E '\\+http|_http' > /dev/null", appname, id)) == 0
|
||||
e.http_status = luci.sys.call(string.format("/bin/busybox top -bn1 | grep -v -E 'grep|acl/|acl_' | grep '%s/bin/' | grep '/%s' | grep -E '\\+http|_http' > /dev/null", appname, id)) == 0
|
||||
end
|
||||
http_write_json(e)
|
||||
end
|
||||
|
||||
@@ -63,15 +63,9 @@ o:value("shadowsocks", "Shadowsocks")
|
||||
o:value("trojan", "Trojan")
|
||||
o:value("hysteria2", "Hysteria2")
|
||||
o:value("wireguard", "WireGuard")
|
||||
o:value("dokodemo-door", "dokodemo-door")
|
||||
o:value("tunnel", "Tunnel")
|
||||
o:depends({ custom = false })
|
||||
|
||||
o = s:option(DummyValue, "is_endpoint", "")
|
||||
o.not_rewrite = true
|
||||
o.template = m:template_path("/cbi/hidevalue")
|
||||
o.value = "1"
|
||||
o:depends({ custom = false, protocol = "wireguard" })
|
||||
|
||||
o = s:option(Value, "port", translate("Listen Port"))
|
||||
o.datatype = "port"
|
||||
o:depends({ custom = false })
|
||||
@@ -93,14 +87,14 @@ o = s:option(ListValue, "d_protocol", translate("Destination protocol"))
|
||||
o:value("tcp", "TCP")
|
||||
o:value("udp", "UDP")
|
||||
o:value("tcp,udp", "TCP,UDP")
|
||||
o:depends({ protocol = "dokodemo-door" })
|
||||
o:depends({ protocol = "tunnel" })
|
||||
|
||||
o = s:option(Value, "d_address", translate("Destination address"))
|
||||
o:depends({ protocol = "dokodemo-door" })
|
||||
o:depends({ protocol = "tunnel" })
|
||||
|
||||
o = s:option(Value, "d_port", translate("Destination port"))
|
||||
o.datatype = "port"
|
||||
o:depends({ protocol = "dokodemo-door" })
|
||||
o:depends({ protocol = "tunnel" })
|
||||
|
||||
o = s:option(Value, "decryption", translate("Encrypt Method") .. " (decryption)")
|
||||
o.default = "none"
|
||||
@@ -411,7 +405,8 @@ end
|
||||
--[[acceptProxyProtocol]]
|
||||
o = s:option(Flag, "acceptProxyProtocol", translate("acceptProxyProtocol"), translate("Whether to receive PROXY protocol, when this node want to be fallback or forwarded by proxy, it must be enable, otherwise it cannot be used."))
|
||||
o.default = "0"
|
||||
o:depends({ custom = false, is_endpoint = "" })
|
||||
o:depends({ transport = "raw" })
|
||||
o:depends({ transport = "ws" })
|
||||
|
||||
--[[Fast Open]]
|
||||
o = s:option(Flag, "tcp_fast_open", "TCP " .. translate("Fast Open"))
|
||||
|
||||
@@ -1748,6 +1748,7 @@ function apply_redirect(m)
|
||||
end
|
||||
end
|
||||
else
|
||||
uci:revert(c_config .. "_redirect")
|
||||
sys.call("/bin/rm -f " .. tmp_uci_file)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -567,11 +567,11 @@ function gen_config_server(node)
|
||||
version = 2,
|
||||
users = users
|
||||
}
|
||||
elseif node.protocol == "dokodemo-door" then
|
||||
elseif node.protocol == "tunnel" then
|
||||
settings = {
|
||||
network = node.d_protocol,
|
||||
address = node.d_address,
|
||||
port = tonumber(node.d_port)
|
||||
allowedNetwork = node.d_protocol,
|
||||
rewriteAddress = node.d_address,
|
||||
rewritePort = tonumber(node.d_port)
|
||||
}
|
||||
elseif node.protocol == "wireguard" then
|
||||
settings = {
|
||||
@@ -1231,8 +1231,8 @@ function gen_config(var)
|
||||
tag = in_tag,
|
||||
listen = "127.0.0.1",
|
||||
port = new_port,
|
||||
protocol = "dokodemo-door",
|
||||
settings = {network = "tcp,udp", address = to_node.address, port = tonumber(to_node.port)}
|
||||
protocol = "tunnel",
|
||||
settings = {allowedNetwork = "tcp,udp", rewriteAddress = to_node.address, rewritePort = tonumber(to_node.port)}
|
||||
})
|
||||
if to_node.tls_serverName == nil then
|
||||
to_node.tls_serverName = to_node.address
|
||||
@@ -1587,8 +1587,8 @@ function gen_config(var)
|
||||
|
||||
if tcp_redir_port or udp_redir_port then
|
||||
local inbound = {
|
||||
protocol = "dokodemo-door",
|
||||
settings = {network = "tcp,udp", followRedirect = true},
|
||||
protocol = "tunnel",
|
||||
settings = {allowedNetwork = "tcp,udp", followRedirect = true},
|
||||
streamSettings = {sockopt = {tproxy = "tproxy"}},
|
||||
sniffing = {
|
||||
enabled = (xray_settings.sniffing_override_dest == "1") or (node and node.protocol == "_shunt") or false
|
||||
@@ -1614,7 +1614,7 @@ function gen_config(var)
|
||||
if tcp_redir_port then
|
||||
local tcp_inbound = api.clone(inbound)
|
||||
tcp_inbound.tag = "tcp_redir"
|
||||
tcp_inbound.settings.network = "tcp"
|
||||
tcp_inbound.settings.allowedNetwork = "tcp"
|
||||
tcp_inbound.port = tonumber(tcp_redir_port)
|
||||
tcp_inbound.streamSettings.sockopt.tproxy = tcp_proxy_way
|
||||
table.insert(inbounds, tcp_inbound)
|
||||
@@ -1623,7 +1623,7 @@ function gen_config(var)
|
||||
if udp_redir_port then
|
||||
local udp_inbound = api.clone(inbound)
|
||||
udp_inbound.tag = "udp_redir"
|
||||
udp_inbound.settings.network = "udp"
|
||||
udp_inbound.settings.allowedNetwork = "udp"
|
||||
udp_inbound.port = tonumber(udp_redir_port)
|
||||
table.insert(inbounds, udp_inbound)
|
||||
end
|
||||
@@ -1790,11 +1790,10 @@ function gen_config(var)
|
||||
table.insert(inbounds, {
|
||||
listen = "127.0.0.1",
|
||||
port = tonumber(dns_listen_port),
|
||||
protocol = "dokodemo-door",
|
||||
protocol = "tunnel",
|
||||
tag = "dns-in",
|
||||
settings = {
|
||||
address = "0.0.0.0",
|
||||
network = "tcp,udp"
|
||||
allowedNetwork = "tcp,udp"
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ window.lv_dropdown_data["<%=cbid%>"] = <%=json.stringify(dropdown_data)%>;
|
||||
<!-- 模拟 ListValue 控件外观 -->
|
||||
<div class="cbi-input-value cbi-input-select lv-dropdown-display" id="<%=cbid%>.display" tabindex="0">
|
||||
<span id="<%=cbid%>.label" class="lv-dropdown-label" title="<%=pcdata(current_label)%>">
|
||||
<%=pcdata("("..translate("Not set")..")")%>
|
||||
<%=pcdata("( "..translate("Not Set").." )")%>
|
||||
</span>
|
||||
<span class="lv-arrow-down"></span>
|
||||
</div>
|
||||
@@ -139,7 +139,7 @@ window.lv_dropdown_data["<%=cbid%>"] = <%=json.stringify(dropdown_data)%>;
|
||||
});
|
||||
lv_registerAdaptive(cbid);
|
||||
setTimeout(() => {
|
||||
labelSpan.textContent = lv_ellipsisByWidth(cbid, '<%=pcdata(current_label ~= "" and current_label or ("("..translate("Not set")..")"))%>');
|
||||
labelSpan.textContent = lv_ellipsisByWidth(cbid, '<%=pcdata(current_label ~= "" and current_label or ("( "..translate("Not Set").." )"))%>');
|
||||
}, 100);
|
||||
})();
|
||||
//]]>
|
||||
|
||||
@@ -1639,6 +1639,7 @@ local current_node = map:get(section)
|
||||
opt.set(dom_prefix + 'hysteria2_hop', queryParam.mport || "");
|
||||
opt.set(dom_prefix + 'use_finalmask', !!queryParam.fm);
|
||||
opt.set(dom_prefix + 'finalmask', queryParam.fm || "");
|
||||
if (is_singbox && (queryParam.pcs || queryParam.pinSHA256)) queryParam.allowinsecure = '1';
|
||||
} else if (has_hysteria2) {
|
||||
opt.set('type', "Hysteria2");
|
||||
dom_prefix = "hysteria2_"
|
||||
@@ -1652,15 +1653,14 @@ local current_node = map:get(section)
|
||||
opt.set(dom_prefix + 'obfs_MaxPacketSize', queryParam.maxPacketSize || "1200");
|
||||
}
|
||||
opt.set(dom_prefix + 'hop', queryParam.mport || "");
|
||||
if (queryParam.pcs || queryParam.pinSHA256) queryParam.allowinsecure = '0';
|
||||
}
|
||||
|
||||
opt.set(dom_prefix + 'address', unbracketIP(m.hostname));
|
||||
opt.set(dom_prefix + 'port', m.port || "443");
|
||||
|
||||
opt.set(dom_prefix + 'tls_serverName', queryParam.sni || "");
|
||||
opt.set(
|
||||
dom_prefix + 'tls_allowInsecure',
|
||||
!((queryParam.allowinsecure ?? '0') === '0' && (queryParam.allowInsecure ?? '0') === '0' && (queryParam.insecure ?? '0') === '0')
|
||||
(queryParam.allowinsecure ?? queryParam.allowInsecure ?? queryParam.insecure ?? '0') === '1'
|
||||
);
|
||||
opt.set(dom_prefix + 'tls_pinSHA256', queryParam.pcs || queryParam.pinSHA256 || '');
|
||||
opt.set(dom_prefix + 'tls_CertByName', queryParam.vcn || '');
|
||||
|
||||
@@ -39,6 +39,10 @@ for sid in $(uci -q show passwall_server | sed -n 's/^passwall_server\.\([^.=]*\
|
||||
uci -q set "passwall_server.${sid}=server"
|
||||
fi
|
||||
done
|
||||
for sid in $(uci -q show passwall_server | sed -n 's/^passwall_server\.\([^.=]*\)\.protocol=dokodemo-door$/\1/p'); do
|
||||
uci -q set "passwall_server.${sid}.protocol=tunnel"
|
||||
done
|
||||
|
||||
uci -q commit passwall_server
|
||||
|
||||
rm -f /tmp/luci-indexcache /tmp/luci-indexcache.*
|
||||
|
||||
@@ -27,6 +27,8 @@ while [ 1 -eq 1 ]; do
|
||||
*dns2socks*) cmd_check=${cmd_check//:/ } ;;
|
||||
esac
|
||||
|
||||
cmd_check=$(printf '%s' "$cmd_check" | sed 's/[^a-zA-Z0-9 ]/\\&/g')
|
||||
|
||||
filename=$(basename "$file")
|
||||
stats_file="${RESTART_STATS_DIR}/${filename}.count"
|
||||
if [ -s "$stats_file" ]; then
|
||||
@@ -38,11 +40,11 @@ while [ 1 -eq 1 ]; do
|
||||
# 检查是否超过最大重启次数
|
||||
[ "$restart_count" -ge "$MAX_RESTART_COUNT" ] && continue
|
||||
|
||||
if ! busybox pgrep -f "$cmd_check" >/dev/null; then
|
||||
if ! busybox pgrep -f "${cmd_check}" >/dev/null; then
|
||||
restart_count=$((restart_count + 1))
|
||||
echo "$restart_count" > "$stats_file"
|
||||
#echo "${cmd} 进程挂掉,重启" >> /tmp/log/passwall.log
|
||||
sh -c "nohup $cmd 2>&1 &"
|
||||
sh -c "nohup ${cmd} 2>&1 &"
|
||||
sleep 1
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -145,13 +145,14 @@ do
|
||||
CONFIG[#CONFIG + 1] = {
|
||||
log = true,
|
||||
remarks = name .. "节点",
|
||||
currentNode = node_id and (function()
|
||||
local section = uci_get(node_id) or {}
|
||||
currentNode = (function(id)
|
||||
local section = id and uci_get(id) or nil
|
||||
if not section then return nil end
|
||||
if section[".type"] == "socks" then
|
||||
return { Socks = node_id }
|
||||
return { Socks = id }
|
||||
end
|
||||
return section
|
||||
end)() or nil,
|
||||
end)(node_id),
|
||||
set = function(o, server)
|
||||
uci_set(szType, option, server)
|
||||
o.newNodeId = server
|
||||
@@ -264,13 +265,14 @@ do
|
||||
log = true,
|
||||
id = t[".name"],
|
||||
remarks = "访问控制列表[" .. i .. "]",
|
||||
currentNode = node_id and (function()
|
||||
local section = uci_get(node_id) or {}
|
||||
currentNode = (function(id)
|
||||
local section = id and uci_get(id) or nil
|
||||
if not section then return nil end
|
||||
if section[".type"] == "socks" then
|
||||
return { Socks = node_id }
|
||||
return { Socks = id }
|
||||
end
|
||||
return section
|
||||
end)() or nil,
|
||||
end)(node_id),
|
||||
set = function(o, server)
|
||||
uci_set(t[".name"], option, server)
|
||||
o.newNodeId = server
|
||||
@@ -1469,8 +1471,6 @@ local function processData(szType, content, add_mode, group, sub_cfg)
|
||||
result.tls_serverName = params.sni
|
||||
result.tls_pinSHA256 = params.pcs or params.pinsha256
|
||||
result.tls_CertByName = params.vcn
|
||||
local insecure = params.allowinsecure or params.insecure
|
||||
result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (sub_allowinsecure and "1" or "0")
|
||||
result.hysteria2_up_mbps = params.upmbps or (sub_cfg and sub_hy_up_mbps or nil)
|
||||
result.hysteria2_down_mbps = params.downmbps or (sub_cfg and sub_hy_down_mbps or nil)
|
||||
result.hysteria2_hop = params.mport
|
||||
@@ -1482,19 +1482,26 @@ local function processData(szType, content, add_mode, group, sub_cfg)
|
||||
result.hysteria2_obfs_MinPacketSize = params.minpacketsize or "512"
|
||||
result.hysteria2_obfs_MaxPacketSize = params.maxpacketsize or "1200"
|
||||
end
|
||||
|
||||
if (sub_hysteria2_type == "sing-box" and has_singbox) or (sub_hysteria2_type == "xray" and has_xray) then
|
||||
local is_singbox = sub_hysteria2_type == "sing-box" and has_singbox
|
||||
result.type = is_singbox and 'sing-box' or 'Xray'
|
||||
result.protocol = "hysteria2"
|
||||
result.use_finalmask = (params.fm and params.fm ~= "") and "1" or nil
|
||||
result.finalmask = (params.fm and params.fm ~= "") and api.base64Encode(params.fm) or nil
|
||||
if is_singbox and (params.pcs or params.pinsha256) then
|
||||
params.allowinsecure = "1"
|
||||
end
|
||||
elseif has_hysteria2 then
|
||||
result.type = "Hysteria2"
|
||||
if params.pcs or params.pinsha256 then
|
||||
params.allowinsecure = "0"
|
||||
end
|
||||
else
|
||||
log("跳过 Hysteria2 节点,因未适配到 Hysteria2 核心程序,或未正确设置节点使用类型。")
|
||||
return nil
|
||||
end
|
||||
local insecure = params.allowinsecure or params.insecure
|
||||
result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (sub_allowinsecure and "1" or "0")
|
||||
elseif szType == 'tuic' then
|
||||
if has_singbox then
|
||||
result.type = 'sing-box'
|
||||
|
||||
Reference in new issue
Block a user