From 8461e33fd1f8b7a78eb3975ea6a0d46349022ecd Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Sat, 17 Apr 2021 00:42:13 +0800 Subject: [PATCH] luci-app-ssr-plus: move ss-rust hack to configuration Finally fixed this... Signed-off-by: Tianling Shen --- .../root/etc/init.d/shadowsocksr | 15 +++++++-------- .../root/usr/share/shadowsocksr/gen_config.lua | 1 + 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package/lean/luci-app-ssr-plus/root/etc/init.d/shadowsocksr b/package/lean/luci-app-ssr-plus/root/etc/init.d/shadowsocksr index 1216ec283a..1c4d0effed 100755 --- a/package/lean/luci-app-ssr-plus/root/etc/init.d/shadowsocksr +++ b/package/lean/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!" ;; diff --git a/package/lean/luci-app-ssr-plus/root/usr/share/shadowsocksr/gen_config.lua b/package/lean/luci-app-ssr-plus/root/usr/share/shadowsocksr/gen_config.lua index 05d1401ac1..2ec2b01dfb 100644 --- a/package/lean/luci-app-ssr-plus/root/usr/share/shadowsocksr/gen_config.lua +++ b/package/lean/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),