Browse Source

Fix configuration errors and trojan-go udp mode

Mattraks 4 years ago
parent
commit
9650224654
1 changed files with 23 additions and 4 deletions
  1. 23 4
      luci-app-ssr-plus/root/etc/init.d/shadowsocksr

+ 23 - 4
luci-app-ssr-plus/root/etc/init.d/shadowsocksr

@@ -283,7 +283,7 @@ gen_config_file() { #server1 type2 code3 local_port4 socks_port5 threads5
 	vmess | vless)
 		lua /usr/share/shadowsocksr/gen_config.lua $1 $mode $4 $5 >$config_file
 		;;
-	trojan | trojan-go)
+	trojan)
 		case "$3" in
 		1)
 			lua /usr/share/shadowsocksr/gen_config.lua $1 nat $4 >$config_file
@@ -295,10 +295,24 @@ gen_config_file() { #server1 type2 code3 local_port4 socks_port5 threads5
 			lua /usr/share/shadowsocksr/gen_config.lua $1 client $tmp_port >$shunt_dns_config_file
 			;;
 		4)
-			lua /usr/share/shadowsocksr/gen_config.lua $1 $mode $4 >$config_file
+			lua /usr/share/shadowsocksr/gen_config.lua $1 client $4 >$config_file
+			;;
+		esac
+		;;
+	trojan-go)
+		case "$3" in
+		1 | 2)
+			lua /usr/share/shadowsocksr/gen_config.lua $1 nat $4 >$config_file
+			;;
+		3)
+			lua /usr/share/shadowsocksr/gen_config.lua $1 client $tmp_port >$shunt_dns_config_file
+			;;
+		4)
+			lua /usr/share/shadowsocksr/gen_config.lua $1 client $4 >$config_file
 			;;
 		esac
 		;;
+
 	naiveproxy)
 		case "$3" in
 		1)
@@ -342,12 +356,17 @@ start_udp() {
 		ln_start_bin $(first_type xray v2ray) v2ray -config $udp_config_file
 		echolog "UDP TPROXY Relay:$($(first_type "xray" "v2ray") -version | head -1) Started!"
 		;;
-	trojan | trojan-go) #client
+	trojan) #client
 		gen_config_file $UDP_RELAY_SERVER $type 2 $tmp_udp_local_port
 		ln_start_bin $(first_type trojan-go trojan) $type --config $udp_config_file
 		ln_start_bin $(first_type ipt2socks) ipt2socks -U -b 0.0.0.0 -4 -s 127.0.0.1 -p $tmp_udp_local_port -l $tmp_udp_port
 		echolog "UDP TPROXY Relay:$($(first_type trojan-go trojan) --version 2>&1 | head -1) Started!"
 		;;
+	trojan-go)
+		gen_config_file $UDP_RELAY_SERVER $type 2 $udp_config_file
+		ln_start_bin $(first_type trojan-go trojan) $type --config $udp_config_file
+		echolog "UDP TPROXY Relay:$($(first_type trojan-go trojan) --version 2>&1 | head -1) Started!"
+		;;
 	naiveproxy)
 		echolog "NaïveProxy UDP TPROXY Relay not supported!"
 		redir_udp=0
@@ -445,7 +464,7 @@ start_local() {
 		echolog "Global_Socks5:$(get_name $type) Started!"
 		;;
 	vmess | vless)
-		if [ "_local" == "1" ]; then
+		if [ "$_local" == "2" ]; then
 			gen_config_file $LOCAL_SERVER $type 4 0 $local_port
 			ln_start_bin $(first_type xray v2ray) v2ray -config $local_config_file
 			echolog "Global_Socks5:$($(first_type "xray" "v2ray") -version | head -1) Started!"