Merge pull request #331 from Mattraks/fix

Fix configuration errors and trojan-go udp mode
This commit is contained in:
coolsnowwolf authored and GitHub committed 2021-01-21 20:09:00 +08:00
commit d88175cba7
3 files changed
+24 -6

No files matched your search

+1 -1
View File
@@ -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
+22 -4
View File
@@ -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,7 +295,20 @@ 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
;;
@@ -342,12 +355,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 +463,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!"
@@ -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),