mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-30 07:45:13 +08:00
🍓 Sync 2026-08-11 20:54:16
This commit is contained in:
1 parent
bb66713991
commit
babe17d95d
23 files changed
+228
-213
No files matched your search
@@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-passwall2
|
||||
PKG_VERSION:=26.8.10
|
||||
PKG_RELEASE:=77
|
||||
PKG_RELEASE:=78
|
||||
PKG_PO_VERSION:=$(PKG_VERSION)
|
||||
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
|
||||
@@ -370,7 +370,7 @@ function socks_status()
|
||||
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_|HTTP2SOCKS' > /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
|
||||
|
||||
@@ -68,11 +68,15 @@ frag_dly=$(uci -q get passwall2.@global_xray[0].fragment_delay)
|
||||
[ -n "$frag_dly" ] && uci -q set passwall2.@global_xray[0].fragment_delays="$frag_dly" && uci -q delete passwall2.@global_xray[0].fragment_delay
|
||||
|
||||
for sid in $(uci show passwall2 | grep "=socks" | awk -F '.' '{print $2}' | awk -F '=' '{print $1}'); do
|
||||
if [ -z "$(echo ${sid} | grep '^socks_')" ]; then
|
||||
new_id="socks_$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 5)"
|
||||
uci -q rename passwall2.${sid}="${new_id}"
|
||||
unset sid new_id
|
||||
fi
|
||||
if [ -z "$(echo ${sid} | grep '^socks_')" ]; then
|
||||
new_id="socks_$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 5)"
|
||||
old_ref="Socks_${sid}"
|
||||
uci -q rename passwall2.${sid}="${new_id}"
|
||||
for item in $(uci show passwall2 | grep "='${old_ref}'\$" | cut -d '=' -sf 1); do
|
||||
uci -q set ${item}="${new_id}"
|
||||
done
|
||||
unset sid new_id old_ref item
|
||||
fi
|
||||
done
|
||||
for sid in $(uci show passwall2 | grep "@acl_rule" | cut -d '.' -sf 2 | cut -d '=' -sf 1); do
|
||||
new_id="acl_$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 5)"
|
||||
|
||||
@@ -402,7 +402,7 @@ run_socks() {
|
||||
sing-box)
|
||||
[ "$http_port" != "0" ] && {
|
||||
http_flag=1
|
||||
config_file="${config_file//SOCKS/HTTP_SOCKS}"
|
||||
config_file="${config_file%%.*}+http${config_file#${config_file%%.*}}"
|
||||
json_add_string "local_http_address" "${bind}"
|
||||
json_add_string "local_http_port" "${http_port}"
|
||||
}
|
||||
@@ -430,7 +430,7 @@ run_socks() {
|
||||
xray)
|
||||
[ "$http_port" != "0" ] && {
|
||||
http_flag=1
|
||||
config_file="${config_file//SOCKS/HTTP_SOCKS}"
|
||||
config_file="${config_file%%.*}+http${config_file#${config_file%%.*}}"
|
||||
json_add_string "local_http_address" "${bind}"
|
||||
json_add_string "local_http_port" "${http_port}"
|
||||
}
|
||||
@@ -474,7 +474,7 @@ run_socks() {
|
||||
json_add_string "local_socks_port" "${socks_port}"
|
||||
[ "$http_port" != "0" ] && {
|
||||
http_flag=1
|
||||
config_file="${config_file//SOCKS/HTTP_SOCKS}"
|
||||
config_file="${config_file%%.*}+http${config_file#${config_file%%.*}}"
|
||||
json_add_string "local_http_address" "${bind}"
|
||||
json_add_string "local_http_port" "${http_port}"
|
||||
}
|
||||
@@ -491,7 +491,7 @@ run_socks() {
|
||||
json_add_string "local_socks_port" "${socks_port}"
|
||||
[ "$http_port" != "0" ] && {
|
||||
http_flag=1
|
||||
config_file="${config_file//SOCKS/HTTP_SOCKS}"
|
||||
config_file="${config_file%%.*}+http${config_file#${config_file%%.*}}"
|
||||
json_add_string "local_http_address" "${bind}"
|
||||
json_add_string "local_http_port" "${http_port}"
|
||||
}
|
||||
@@ -535,16 +535,16 @@ socks_node_switch() {
|
||||
local flag new_node
|
||||
eval_set_val $@
|
||||
[ -n "$flag" ] && [ -n "$new_node" ] && {
|
||||
local prefix pf filename
|
||||
local suffix pf filename
|
||||
# Kill the SS plugin process
|
||||
for prefix in "" "HTTP_"; do
|
||||
pf="$TMP_PATH/${prefix}${flag}_plugin.pid"
|
||||
for suffix in "" "+http"; do
|
||||
pf="$TMP_PATH/${flag}${suffix}_plugin.pid"
|
||||
[ -s "$pf" ] && kill -9 "$(head -n1 "$pf")" >/dev/null 2>&1
|
||||
done
|
||||
|
||||
busybox pgrep -af "$TMP_BIN_PATH" | awk -v P1="${flag}" 'BEGIN{IGNORECASE=1}$0~P1 && !/acl\/|acl_/{print $1}' | xargs kill -9 >/dev/null 2>&1
|
||||
for prefix in "" "HTTP_" "HTTP2"; do
|
||||
rm -rf "$TMP_PATH/${prefix}${flag}"*
|
||||
for suffix in "" "+http" "_http"; do
|
||||
rm -rf "$TMP_PATH/${flag}${suffix}"*
|
||||
done
|
||||
|
||||
for filename in $(ls ${TMP_SCRIPT_FUNC_PATH}); do
|
||||
@@ -560,7 +560,7 @@ socks_node_switch() {
|
||||
local log=$(config_n_get $flag log 1)
|
||||
[ "$log" == "0" ] && log_file=""
|
||||
local http_port=$(config_n_get $flag http_port 0)
|
||||
local http_config_file="HTTP2SOCKS_${flag}.json"
|
||||
local http_config_file="${flag}_http.json"
|
||||
LOG_FILE="/dev/null"
|
||||
run_socks flag=$flag node=$new_node bind=$bind socks_port=$port config_file=$config_file http_port=$http_port http_config_file=$http_config_file log_file=$log_file
|
||||
set_cache_var "${flag}" "$new_node"
|
||||
@@ -727,7 +727,7 @@ start_socks() {
|
||||
local log=$(config_n_get $id log 1)
|
||||
[ "$log" == "0" ] && log_file=""
|
||||
local http_port=$(config_n_get $id http_port 0)
|
||||
local http_config_file="HTTP2SOCKS_${id}.json"
|
||||
local http_config_file="${id}_http.json"
|
||||
run_socks flag=$id node=$node bind=$bind socks_port=$port config_file=$config_file http_port=$http_port http_config_file=$http_config_file log_file=$log_file
|
||||
set_cache_var "${id}" "$node"
|
||||
|
||||
|
||||
Reference in new issue
Block a user