From 965022465407071e2cf00b55542f4be255f872f5 Mon Sep 17 00:00:00 2001 From: Mattraks <16359027+Mattraks@users.noreply.github.com> Date: Thu, 21 Jan 2021 12:10:48 +0800 Subject: [PATCH 1/2] Fix configuration errors and trojan-go udp mode --- .../root/etc/init.d/shadowsocksr | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/luci-app-ssr-plus/root/etc/init.d/shadowsocksr b/luci-app-ssr-plus/root/etc/init.d/shadowsocksr index 6396d142..caf446a0 100755 --- a/luci-app-ssr-plus/root/etc/init.d/shadowsocksr +++ b/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!" From 7969f0fa78e961c8ad326c1bc075a57c25d5584b Mon Sep 17 00:00:00 2001 From: Mattraks <16359027+Mattraks@users.noreply.github.com> Date: Thu, 21 Jan 2021 17:49:29 +0800 Subject: [PATCH 2/2] Fix Bug --- luci-app-ssr-plus/Makefile | 2 +- luci-app-ssr-plus/root/etc/init.d/shadowsocksr | 1 - luci-app-ssr-plus/root/usr/share/shadowsocksr/gen_config.lua | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/luci-app-ssr-plus/Makefile b/luci-app-ssr-plus/Makefile index 67245b7c..6a3fc284 100644 --- a/luci-app-ssr-plus/Makefile +++ b/luci-app-ssr-plus/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-ssr-plus PKG_VERSION:=182 -PKG_RELEASE:=7 +PKG_RELEASE:=8 define Package/$(PKG_NAME)/conffiles /etc/config/shadowsocksr diff --git a/luci-app-ssr-plus/root/etc/init.d/shadowsocksr b/luci-app-ssr-plus/root/etc/init.d/shadowsocksr index caf446a0..cb13bb35 100755 --- a/luci-app-ssr-plus/root/etc/init.d/shadowsocksr +++ b/luci-app-ssr-plus/root/etc/init.d/shadowsocksr @@ -312,7 +312,6 @@ gen_config_file() { #server1 type2 code3 local_port4 socks_port5 threads5 ;; esac ;; - naiveproxy) case "$3" in 1) diff --git a/luci-app-ssr-plus/root/usr/share/shadowsocksr/gen_config.lua b/luci-app-ssr-plus/root/usr/share/shadowsocksr/gen_config.lua index f4c8eb76..f4280977 100644 --- a/luci-app-ssr-plus/root/usr/share/shadowsocksr/gen_config.lua +++ b/luci-app-ssr-plus/root/usr/share/shadowsocksr/gen_config.lua @@ -18,7 +18,7 @@ local Xray = { sniffing = {enabled = true, destOverride = {"http", "tls"}} } or nil, -- 开启 socks 代理 - inboundDetour = (proto == "tcp" and socks_port ~= "0") and { + inboundDetour = (proto:find("tcp") and socks_port ~= "0") and { { protocol = "socks", port = tonumber(socks_port),