From 1c162c0639c087bd719ec05c040ad414198b4a6a Mon Sep 17 00:00:00 2001
From: bol-van <none@none.none>
Date: Fri, 20 Sep 2024 09:52:31 +0300
Subject: [PATCH] use TPWS_OPT_SUFFIX in scripts

---
 init.d/macos/custom-tpws                    | 1 +
 init.d/macos/functions                      | 2 ++
 init.d/openwrt/custom-tpws4http-nfqws4https | 1 +
 init.d/openwrt/zapret                       | 2 ++
 init.d/sysv/custom-tpws4http-nfqws4https    | 1 +
 init.d/sysv/functions                       | 2 ++
 install_easy.sh                             | 2 +-
 7 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/init.d/macos/custom-tpws b/init.d/macos/custom-tpws
index c32d5cb..cf3aea6 100644
--- a/init.d/macos/custom-tpws
+++ b/init.d/macos/custom-tpws
@@ -7,6 +7,7 @@ zapret_custom_daemons()
 	# $1 - 1 - run, 0 - stop
 	local opt="--user=root --port=$TPPORT_MY"
 	filter_apply_hostlist_target opt
+	filter_apply_suffix opt "$TPWS_OPT_SUFFIX"
 	tpws_apply_binds opt
 	opt="$opt $TPWS_OPT"
 	do_daemon $1 1 "$TPWS" "$opt"
diff --git a/init.d/macos/functions b/init.d/macos/functions
index 45f678e..d5d9ca9 100644
--- a/init.d/macos/functions
+++ b/init.d/macos/functions
@@ -164,6 +164,7 @@ zapret_do_daemons()
 			# MacOS requires root. kernel hardcoded requirement for /dev/pf ioctls
 			opt="--user=root --port=$TPPORT"
 			filter_apply_hostlist_target opt
+			filter_apply_suffix opt "$TPWS_OPT_SUFFIX"
 			tpws_apply_binds opt
 			opt="$opt $TPWS_OPT"
 			do_daemon $1 1 "$TPWS" "$opt"
@@ -176,6 +177,7 @@ zapret_do_daemons()
 			opt="--socks --user=$WS_USER --port=$TPPORT"
 			tpws_apply_socks_binds opt
 			filter_apply_hostlist_target opt
+			filter_apply_suffix opt "$TPWS_OPT_SUFFIX"
 			opt="$opt $TPWS_OPT"
 			do_daemon $1 1 "$TPWS" "$opt"
 			;;
diff --git a/init.d/openwrt/custom-tpws4http-nfqws4https b/init.d/openwrt/custom-tpws4http-nfqws4https
index 333e7c3..d777aa8 100644
--- a/init.d/openwrt/custom-tpws4http-nfqws4https
+++ b/init.d/openwrt/custom-tpws4http-nfqws4https
@@ -10,6 +10,7 @@ zapret_custom_daemons()
 	[ "$MODE_HTTP" = "1" ] && {
 		opt="--port=$TPPORT $TPWS_OPT"
 		filter_apply_hostlist_target opt
+		filter_apply_suffix opt "$TPWS_OPT_SUFFIX"
 		run_tpws 1 "$opt"
 	}
 
diff --git a/init.d/openwrt/zapret b/init.d/openwrt/zapret
index f30b3ef..208dc67 100755
--- a/init.d/openwrt/zapret
+++ b/init.d/openwrt/zapret
@@ -122,11 +122,13 @@ start_daemons_procd()
 		tpws)
 			opt="--port=$TPPORT $TPWS_OPT"
 			filter_apply_hostlist_target opt
+			filter_apply_suffix opt "$TPWS_OPT_SUFFIX"
 			run_tpws 1 "$opt"
 			;;
 		tpws-socks)
 			opt="--port=$TPPORT $TPWS_OPT"
 			filter_apply_hostlist_target opt
+			filter_apply_suffix opt "$TPWS_OPT_SUFFIX"
 			run_tpws_socks 1 "$opt"
 			;;
 		nfqws)
diff --git a/init.d/sysv/custom-tpws4http-nfqws4https b/init.d/sysv/custom-tpws4http-nfqws4https
index 9689880..95042c0 100644
--- a/init.d/sysv/custom-tpws4http-nfqws4https
+++ b/init.d/sysv/custom-tpws4http-nfqws4https
@@ -10,6 +10,7 @@ zapret_custom_daemons()
 	[ "$MODE_HTTP" = "1" ] && {
 		opt="--port=$TPPORT $TPWS_OPT"
 		filter_apply_hostlist_target opt
+		filter_apply_suffix opt "$TPWS_OPT_SUFFIX"
 		do_tpws $1 1 "$opt"
 	}
 
diff --git a/init.d/sysv/functions b/init.d/sysv/functions
index 2553d02..519c1e0 100644
--- a/init.d/sysv/functions
+++ b/init.d/sysv/functions
@@ -291,11 +291,13 @@ zapret_do_daemons()
 		tpws)
 			opt="--port=$TPPORT $TPWS_OPT"
 			filter_apply_hostlist_target opt
+			filter_apply_suffix opt "$TPWS_OPT_SUFFIX"
 			do_tpws $1 1 "$opt"
 			;;
 		tpws-socks)
 			opt="--port=$TPPORT $TPWS_OPT"
 			filter_apply_hostlist_target opt
+			filter_apply_suffix opt "$TPWS_OPT_SUFFIX"
 			do_tpws_socks $1 1 "$opt"
 			;;
 		nfqws)
diff --git a/install_easy.sh b/install_easy.sh
index dd962e3..68995c3 100755
--- a/install_easy.sh
+++ b/install_easy.sh
@@ -112,7 +112,7 @@ select_mode_mode()
 
 	case $MODE in
 		tpws)
-			vars="TPWS_OPT"
+			vars="TPWS_OPT TPWS_OPT_SUFFIX"
 			;;
 		nfqws)
 			vars="NFQWS_OPT_DESYNC NFQWS_OPT_DESYNC_SUFFIX NFQWS_OPT_DESYNC_HTTP NFQWS_OPT_DESYNC_HTTP_SUFFIX NFQWS_OPT_DESYNC_HTTPS NFQWS_OPT_DESYNC_HTTPS_SUFFIX NFQWS_OPT_DESYNC_HTTP6 NFQWS_OPT_DESYNC_HTTP6_SUFFIX NFQWS_OPT_DESYNC_HTTPS6 NFQWS_OPT_DESYNC_HTTPS6_SUFFIX NFQWS_OPT_DESYNC_QUIC NFQWS_OPT_DESYNC_QUIC_SUFFIX NFQWS_OPT_DESYNC_QUIC6 NFQWS_OPT_DESYNC_QUIC6_SUFFIX"