mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-09-11 10:54:20 +08:00
update 2026-08-16 16:21:47
This commit is contained in:
+1
-1
@@ -10,7 +10,7 @@ PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=51710757f8dc8b08d7dc008864b4e9c740dcf7a4
|
||||
PKG_SOURCE_VERSION:=7666cccc681ad21b66156f95a8db627bcbf2b244
|
||||
PKG_SOURCE_URL:=https://github.com/olicesx/dae.git
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-passwall2
|
||||
PKG_VERSION:=26.8.14
|
||||
PKG_VERSION:=26.8.16
|
||||
PKG_RELEASE:=1
|
||||
PKG_PO_VERSION:=$(PKG_VERSION)
|
||||
|
||||
@@ -15,7 +15,6 @@ PKG_CONFIG_DEPENDS:= \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_Nftables_Transparent_Proxy \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Haproxy \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Hysteria \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Rust_Client \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Rust_Server \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Libev_Client \
|
||||
@@ -91,12 +90,6 @@ config PACKAGE_$(PKG_NAME)_INCLUDE_Hysteria
|
||||
select PACKAGE_hysteria
|
||||
default n
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy
|
||||
bool "Include NaiveProxy"
|
||||
depends on !(arc||armeb||loongarch64||mips||mips64||powerpc||TARGET_gemini)
|
||||
select PACKAGE_naiveproxy
|
||||
default n
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Rust_Client
|
||||
bool "Include Shadowsocks Rust Client"
|
||||
depends on !i386
|
||||
|
||||
@@ -467,14 +467,13 @@ end
|
||||
function delete_select_nodes()
|
||||
local ids = http.formvalue("ids")
|
||||
local redirect = http.formvalue("redirect")
|
||||
local ids_t = {}
|
||||
string.gsub(ids, '[^' .. "," .. ']+', function(w)
|
||||
ids_t[#ids_t + 1] = w
|
||||
if (uci_get("@global[0]", "node") or "") == w then
|
||||
uci_del('@global[0]', "node")
|
||||
end
|
||||
uci_foreach("socks", function(t)
|
||||
if t["node"] == w then
|
||||
uci_del(t[".name"])
|
||||
end
|
||||
local changed = false
|
||||
local auto_switch_node_list = uci_get(t[".name"], "autoswitch_backup_node") or {}
|
||||
for i = #auto_switch_node_list, 1, -1 do
|
||||
@@ -486,6 +485,14 @@ function delete_select_nodes()
|
||||
if changed then
|
||||
uci_set(t[".name"], "autoswitch_backup_node", auto_switch_node_list)
|
||||
end
|
||||
if t["node"] == w then
|
||||
local new_node = api.get_random_normal_node(ids_t)
|
||||
if new_node then
|
||||
uci_set(t[".name"], "node", new_node[".name"])
|
||||
else
|
||||
uci_set(t[".name"], "enabled", "0")
|
||||
end
|
||||
end
|
||||
end)
|
||||
uci_foreach("haproxy_config", function(t)
|
||||
if t["lbss"] == w then
|
||||
|
||||
@@ -308,6 +308,7 @@ o.rmempty = false
|
||||
|
||||
s2 = m:section(TypedSection, "socks", translate("Socks Config"))
|
||||
s2.template = "cbi/tblsection"
|
||||
s2.sortable = true
|
||||
s2.anonymous = true
|
||||
s2.addremove = true
|
||||
s2.extedit = api.url("socks_config", "%s")
|
||||
@@ -383,4 +384,6 @@ end
|
||||
|
||||
m:appendTemplate("/global/footer", {shunt_list = api.jsonc.stringify(shunt_list)})
|
||||
|
||||
m:appendTemplate("/cbi/sortable", {sectiontype = s2.sectiontype})
|
||||
|
||||
return api.return_map(m)
|
||||
|
||||
@@ -92,7 +92,7 @@ o.write = function(self, section, value)
|
||||
if old ~= value then
|
||||
m:foreach("nodes", function(e)
|
||||
if e["group"] and e["group"]:lower() == old:lower() then
|
||||
self:set(e[".name"], "group", value)
|
||||
self.map:set(e[".name"], "group", value)
|
||||
end
|
||||
if e["protocol"] and (e["protocol"] == "_balancing" or e["protocol"] == "_urltest") and e["node_group"] then
|
||||
local gs = ""
|
||||
@@ -104,7 +104,7 @@ o.write = function(self, section, value)
|
||||
end
|
||||
end
|
||||
gs = api.trim(gs)
|
||||
self:set(e[".name"], "node_group", gs)
|
||||
self.map:set(e[".name"], "node_group", gs)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
if not api.is_finded("naive") then
|
||||
return
|
||||
end
|
||||
|
||||
-- [[ Naive ]]
|
||||
local m, s1 = ...
|
||||
local type_name = "Naiveproxy"
|
||||
|
||||
s1.fields["type"]:value(type_name, "NaiveProxy")
|
||||
|
||||
if s1.val["type"] ~= type_name then
|
||||
return
|
||||
end
|
||||
|
||||
local s = NamedSection(m, arg[1], "server")
|
||||
s.type_name = type_name
|
||||
s.option_prefix = "naive_"
|
||||
|
||||
o = s:option(ListValue, "protocol", translate("Protocol"))
|
||||
o:value("https", translate("HTTPS"))
|
||||
o:value("quic", translate("QUIC"))
|
||||
|
||||
o = s:option(Value, "address", translate("Address (Support Domain Name)"))
|
||||
|
||||
o = s:option(Value, "port", translate("Port"))
|
||||
o.datatype = "port"
|
||||
|
||||
o = s:option(Value, "username", translate("Username"))
|
||||
|
||||
o = s:option(Value, "password", translate("Password"))
|
||||
o.password = true
|
||||
|
||||
api.luci_types(s1, s)
|
||||
@@ -598,7 +598,7 @@ function get_valid_nodes()
|
||||
local nodes = {}
|
||||
local default_nodes = {}
|
||||
local other_nodes = {}
|
||||
uci:foreach(c_config, "nodes", function(e)
|
||||
uci_foreach_c("nodes", function(e)
|
||||
e.id = e[".name"]
|
||||
if e.type and e.remarks then
|
||||
local type_name = e.type
|
||||
@@ -671,8 +671,8 @@ function get_node_list()
|
||||
socks_list = {},
|
||||
normal_list = {},
|
||||
}
|
||||
uci:foreach(c_config, "socks", function(s)
|
||||
if s.enabled == "1" and s.node then
|
||||
uci_foreach_c("socks", function(s)
|
||||
if s.node then
|
||||
node_list.socks_list[#node_list.socks_list + 1] = {
|
||||
id = s[".name"],
|
||||
remark = i18n.translate("Socks Config") .. " [" .. s.port .. i18n.translate("Port") .. "]",
|
||||
@@ -760,6 +760,29 @@ function get_full_node_remarks(n)
|
||||
return remarks
|
||||
end
|
||||
|
||||
function get_random_normal_node(exclude_id)
|
||||
local exclude_id_lookup = {}
|
||||
if type(exclude_id) == "table" then
|
||||
for i, v in ipairs(exclude_id) do
|
||||
exclude_id_lookup[v] = true
|
||||
end
|
||||
elseif type(exclude_id) == "string" then
|
||||
exclude_id_lookup[exclude_id] = true
|
||||
end
|
||||
local normal_list = {}
|
||||
for k, e in ipairs(get_valid_nodes()) do
|
||||
if e.node_type == "normal" and not exclude_id_lookup[e[".name"]] then
|
||||
normal_list[#normal_list + 1] = e
|
||||
end
|
||||
end
|
||||
if #normal_list > 0 then
|
||||
math.randomseed(os.time())
|
||||
local num = math.random(1, #normal_list)
|
||||
return normal_list[num]
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
function gen_uuid()
|
||||
local uuid = sys.exec("echo -n $(cat /proc/sys/kernel/random/uuid)")
|
||||
return uuid
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
module("luci.passwall2.util_navieproxy", package.seeall)
|
||||
local api = require "luci.passwall2.api"
|
||||
local jsonc = api.jsonc
|
||||
|
||||
function gen_config(var)
|
||||
local node_id = var["node"]
|
||||
if not node_id then
|
||||
print("node Cannot be empty!")
|
||||
return
|
||||
end
|
||||
local node = api.uci_get_c(node_id)
|
||||
local run_type = var["run_type"]
|
||||
local local_addr = var["local_addr"]
|
||||
local local_port = var["local_port"]
|
||||
local server_host = var["server_host"] or (node.address or ""):lower()
|
||||
local server_port = var["server_port"] or node.port
|
||||
|
||||
if api.is_ipv6(server_host) then
|
||||
server_host = api.get_ipv6_full(server_host)
|
||||
end
|
||||
local server = server_host .. ":" .. server_port
|
||||
|
||||
local config = {
|
||||
listen = run_type .. "://" .. local_addr .. ":" .. local_port,
|
||||
proxy = node.protocol .. "://" .. node.username .. ":" .. node.password .. "@" .. server
|
||||
}
|
||||
|
||||
return jsonc.stringify(config, 1)
|
||||
end
|
||||
|
||||
_G.gen_config = gen_config
|
||||
|
||||
if arg[1] then
|
||||
local func =_G[arg[1]]
|
||||
if func then
|
||||
local var = nil
|
||||
if arg[2] then
|
||||
var = jsonc.parse(arg[2])
|
||||
end
|
||||
print(func(var))
|
||||
end
|
||||
end
|
||||
@@ -12,7 +12,6 @@ LUA_UTIL_PATH=/usr/lib/lua/luci/passwall2
|
||||
UTIL_SINGBOX=$LUA_UTIL_PATH/util_sing-box.lua
|
||||
UTIL_SS=$LUA_UTIL_PATH/util_shadowsocks.lua
|
||||
UTIL_XRAY=$LUA_UTIL_PATH/util_xray.lua
|
||||
UTIL_NAIVE=$LUA_UTIL_PATH/util_naiveproxy.lua
|
||||
UTIL_HYSTERIA2=$LUA_UTIL_PATH/util_hysteria2.lua
|
||||
SINGBOX_BIN=$(first_type $(config_t_get global_app sing_box_file) sing-box)
|
||||
XRAY_BIN=$(first_type $(config_t_get global_app xray_file) xray)
|
||||
@@ -455,14 +454,6 @@ run_socks() {
|
||||
lua $UTIL_XRAY gen_config "${_json_arg}" > $config_file
|
||||
[ -z "$no_run" ] && ln_run ${QUEUE_RUN} "$XRAY_BIN" "xray" $log_file run -c "$config_file"
|
||||
;;
|
||||
naiveproxy)
|
||||
json_add_string "local_addr" "${bind}"
|
||||
json_add_string "local_port" "${socks_port}"
|
||||
json_add_string "run_type" "socks"
|
||||
local _json_arg="$(json_dump)"
|
||||
lua $UTIL_NAIVE gen_config "${_json_arg}" > $config_file
|
||||
[ -z "$no_run" ] && ln_run ${QUEUE_RUN} "$(first_type naive)" naive $log_file "$config_file"
|
||||
;;
|
||||
ssr)
|
||||
json_add_string "local_addr" "${bind}"
|
||||
json_add_string "local_port" "${socks_port}"
|
||||
|
||||
@@ -965,20 +965,27 @@ start_socks5_udp_with_ipt2socks() {
|
||||
local local_port="$2"
|
||||
local threads="$3"
|
||||
local ipt2socks_bin
|
||||
local auth_opts=""
|
||||
local server_ip
|
||||
local _i
|
||||
|
||||
ipt2socks_bin="$(first_type ipt2socks)"
|
||||
server_ip="$(get_host_ip "$sid")"
|
||||
|
||||
[ -x "$ipt2socks_bin" ] || return 1
|
||||
[ -n "$server_ip" ] || {
|
||||
echolog "UDP TPROXY Relay:Socks5 无法解析服务器地址。"
|
||||
return 1
|
||||
}
|
||||
set --
|
||||
if [ "$(uci_get_by_name "$sid" auth_enable 0)" = "1" ]; then
|
||||
auth_opts="-a $(uci_get_by_name "$sid" username) -k $(uci_get_by_name "$sid" password)"
|
||||
set -- -a "$(uci_get_by_name "$sid" username)" \
|
||||
-k "$(uci_get_by_name "$sid" password)"
|
||||
fi
|
||||
for _i in $(seq 1 "$threads"); do
|
||||
ln_start_bin "$ipt2socks_bin" ipt2socks -U -r -b 0.0.0.0 -4 \
|
||||
-s "$(uci_get_by_name "$sid" server)" \
|
||||
-s "$server_ip" \
|
||||
-p "$(uci_get_by_name "$sid" server_port)" \
|
||||
-l "$local_port" "$auth_opts"
|
||||
-l "$local_port" "$@"
|
||||
done
|
||||
echolog "UDP TPROXY Relay:Socks5 via IPT2Socks $threads Threads Started!"
|
||||
return 0
|
||||
@@ -989,21 +996,28 @@ start_socks5_redir_with_ipt2socks() {
|
||||
local local_port="$2"
|
||||
local threads="$3"
|
||||
local ipt2socks_bin
|
||||
local auth_opts=""
|
||||
local server_ip
|
||||
local _i
|
||||
|
||||
ipt2socks_bin="$(first_type ipt2socks)"
|
||||
server_ip="$(get_host_ip "$sid")"
|
||||
|
||||
[ -x "$ipt2socks_bin" ] || return 1
|
||||
[ -n "$server_ip" ] || {
|
||||
echolog "Main node:Socks5 无法解析服务器地址。"
|
||||
return 1
|
||||
}
|
||||
set --
|
||||
if [ "$(uci_get_by_name "$sid" auth_enable 0)" = "1" ]; then
|
||||
auth_opts="-a $(uci_get_by_name "$sid" username) -k $(uci_get_by_name "$sid" password)"
|
||||
set -- -a "$(uci_get_by_name "$sid" username)" \
|
||||
-k "$(uci_get_by_name "$sid" password)"
|
||||
fi
|
||||
for _i in $(seq 1 "$threads"); do
|
||||
ln_start_bin "$ipt2socks_bin" ipt2socks \
|
||||
-T -R -r -b 0.0.0.0 -4 \
|
||||
-s "$(uci_get_by_name "$sid" server)" \
|
||||
-s "$server_ip" \
|
||||
-p "$(uci_get_by_name "$sid" server_port)" \
|
||||
-l "$local_port" "$auth_opts"
|
||||
-l "$local_port" "$@"
|
||||
done
|
||||
echolog "Main node:Socks5 via IPT2Socks $threads Threads Started!"
|
||||
return 0
|
||||
|
||||
@@ -1262,6 +1262,13 @@ compare_rules() {
|
||||
return 0 # No update needed
|
||||
}
|
||||
|
||||
append_nftables_comment() {
|
||||
local name="$1"
|
||||
local value
|
||||
value=$(printf '%s' "$2" | tr '\r\n' ' ')
|
||||
printf '# %s: %s\n' "$name" "$value" >> "$NFTABLES_RULES_FILE"
|
||||
}
|
||||
|
||||
# Auto-update persistence rules
|
||||
persist_nftables_rules() {
|
||||
if [ "$USE_NFT" != "1" ]; then
|
||||
@@ -1296,12 +1303,12 @@ persist_nftables_rules() {
|
||||
echo "# Auto-updated: $(date)" >> "$NFTABLES_RULES_FILE"
|
||||
echo "# Runmode: ${RUNMODE:-router}" >> "$NFTABLES_RULES_FILE"
|
||||
echo "# Server: $server, Port: $local_port" >> "$NFTABLES_RULES_FILE"
|
||||
echo "# WAN_BP_IP: $WAN_BP_IP" >> "$NFTABLES_RULES_FILE"
|
||||
echo "# LAN_AC_IP: $LAN_AC_IP" >> "$NFTABLES_RULES_FILE"
|
||||
echo "# LAN_BP_IP: $LAN_BP_IP" >> "$NFTABLES_RULES_FILE"
|
||||
echo "# WAN_FW_IP: $WAN_FW_IP" >> "$NFTABLES_RULES_FILE"
|
||||
echo "# LAN_FP_IP: $LAN_FP_IP" >> "$NFTABLES_RULES_FILE"
|
||||
echo "# LAN_GM_IP: $LAN_GM_IP" >> "$NFTABLES_RULES_FILE"
|
||||
append_nftables_comment "WAN_BP_IP" "$WAN_BP_IP"
|
||||
append_nftables_comment "LAN_AC_IP" "$LAN_AC_IP"
|
||||
append_nftables_comment "LAN_BP_IP" "$LAN_BP_IP"
|
||||
append_nftables_comment "WAN_FW_IP" "$WAN_FW_IP"
|
||||
append_nftables_comment "LAN_FP_IP" "$LAN_FP_IP"
|
||||
append_nftables_comment "LAN_GM_IP" "$LAN_GM_IP"
|
||||
echo "" >> "$NFTABLES_RULES_FILE"
|
||||
|
||||
local HAS_RULES=0
|
||||
|
||||
Reference in New Issue
Block a user