فهرست منبع

luci-app-ssr-plus: move ss-rust hack to configuration

Finally fixed this...

Signed-off-by: Tianling Shen <[email protected]>
Tianling Shen 4 سال پیش
والد
کامیت
530a31be6c

+ 7 - 8
luci-app-ssr-plus/root/etc/init.d/shadowsocksr

@@ -37,6 +37,7 @@ server_count=0
 redir_tcp=0
 redir_udp=0
 local_enable=0
+ss_protocol=
 kcp_enable_flag=0
 pdnsd_enable_flag=0
 switch_server=$1
@@ -273,14 +274,15 @@ gen_config_file() { #server1 type2 code3 local_port4 socks_port5 threads5
 		config_file=$shunt_config_file
 		;;
 	4)
+		local ss_protocol="socks"
 		config_file=$local_config_file
 		;;
 	esac
 	case "$2" in
 	ss | ssr)
-		lua /usr/share/shadowsocksr/gen_config.lua $1 $mode $4 >$config_file
+		lua /usr/share/shadowsocksr/gen_config.lua $1 $mode $4 ${ss_protocol:-redir} >$config_file
 		if [ "$3" == "3" ]; then
-			lua /usr/share/shadowsocksr/gen_config.lua $1 $mode $tmp_port >$shunt_dns_config_file
+			lua /usr/share/shadowsocksr/gen_config.lua $1 $mode $tmp_port socks >$shunt_dns_config_file
 		fi
 		;;
 	v2ray)
@@ -339,8 +341,7 @@ start_udp() {
 	ss | ssr)
 		gen_config_file $UDP_RELAY_SERVER $type 2 $tmp_udp_port
 		ss_program="$(first_type ${type}local ${type}-redir)"
-		[ "$(printf '%s' "$ss_program" | awk -F '/' '{print $NF}')" = "${type}local" ] && local ss_extra_arg="--protocol redir"
-		ln_start_bin $ss_program ${type}-redir -c $udp_config_file $ss_extra_arg
+		ln_start_bin $ss_program ${type}-redir -c $udp_config_file
 		echolog "UDP TPROXY Relay:$(get_name $type) Started!"
 		;;
 	v2ray)
@@ -382,8 +383,7 @@ start_shunt() {
 	ss | ssr)
 		gen_config_file $SHUNT_SERVER $type 3 $tmp_shunt_port
 		ss_program="$(first_type ${type}local ${type}-redir)"
-		[ "$(printf '%s' "$ss_program" | awk -F '/' '{print $NF}')" = "${type}local" ] && local ss_extra_arg="--protocol redir"
-		ln_start_bin $ss_program ${type}-redir -c $shunt_config_file $ss_extra_arg
+		ln_start_bin $ss_program ${type}-redir -c $shunt_config_file
 		if [ -n "$tmp_local_port" ]; then
 			local tmp_port=$tmp_local_port
 		else
@@ -530,9 +530,8 @@ Start_Run() {
 	ss | ssr)
 		gen_config_file $GLOBAL_SERVER $type 1 $tcp_port
 		ss_program="$(first_type ${type}local ${type}-redir)"
-		[ "$(printf '%s' "$ss_program" | awk -F '/' '{print $NF}')" = "${type}local" ] && local ss_extra_arg="--protocol redir"
 		for i in $(seq 1 $threads); do
-			ln_start_bin "$ss_program" ${type}-redir -c $tcp_config_file $ss_extra_arg
+			ln_start_bin "$ss_program" ${type}-redir -c $tcp_config_file
 		done
 		echolog "Main node:$(get_name $type) $threads Threads Started!"
 		;;

+ 1 - 0
luci-app-ssr-plus/root/usr/share/shadowsocksr/gen_config.lua

@@ -224,6 +224,7 @@ local ss = {
 	local_address = "0.0.0.0",
 	local_port = tonumber(local_port),
 	mode = (proto == "tcp,udp") and "tcp_and_udp" or proto .. "_only",
+	protocol = socks_port,
 	password = server.password,
 	method = server.encrypt_method_ss,
 	timeout = tonumber(server.timeout),