From 900b975c6a85cd25c27ac35e21e8bfce231c5152 Mon Sep 17 00:00:00 2001 From: snail007 Date: Tue, 11 Sep 2018 19:30:47 +0800 Subject: [PATCH 1/3] Update install_auto.sh --- install_auto.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install_auto.sh b/install_auto.sh index 5202b6b..32bf059 100755 --- a/install_auto.sh +++ b/install_auto.sh @@ -5,7 +5,7 @@ if [ -e /tmp/proxy ]; then fi mkdir /tmp/proxy cd /tmp/proxy -wget https://github.com/snail007/goproxy/releases/download/v6.1/proxy-linux-amd64.tar.gz +wget https://github.com/snail007/goproxy/releases/download/v6.0/proxy-linux-amd64.tar.gz # #install proxy tar zxvf proxy-linux-amd64.tar.gz From 70067d67b9623e3e345cbfb26eed1d4d4e34dcee Mon Sep 17 00:00:00 2001 From: Iskander Sharipov Date: Thu, 13 Sep 2018 20:46:16 +0300 Subject: [PATCH 2/3] services: simplify switch statements with case clause lists Case clause lists are simpler and more compact than multiple cases with fallthrough. Found using https://go-critic.github.io/overview#emptyFallthrough-ref --- services/socks/socks.go | 6 +----- services/sps/sps.go | 6 +----- services/tcp/tcp.go | 6 +----- services/udp/udp.go | 4 +--- 4 files changed, 4 insertions(+), 18 deletions(-) diff --git a/services/socks/socks.go b/services/socks/socks.go index 1ca388b..4845ee9 100644 --- a/services/socks/socks.go +++ b/services/socks/socks.go @@ -462,11 +462,7 @@ func (s *Socks) proxyTCP(inConn *net.Conn, serverConn *socks.ServerConn) { } func (s *Socks) GetParentConn(parentAddress string, serverConn *socks.ServerConn) (outConn net.Conn, err interface{}) { switch *s.cfg.ParentType { - case "kcp": - fallthrough - case "tls": - fallthrough - case "tcp": + case "kcp", "tls", "tcp": if *s.cfg.ParentType == "tls" { var _conn tls.Conn _conn, err = utils.TlsConnectHost(parentAddress, *s.cfg.Timeout, s.cfg.CertBytes, s.cfg.KeyBytes, s.cfg.CaCertBytes) diff --git a/services/sps/sps.go b/services/sps/sps.go index da1bad9..6693c94 100644 --- a/services/sps/sps.go +++ b/services/sps/sps.go @@ -273,11 +273,7 @@ func (s *SPS) callback(inConn net.Conn) { var err error lbAddr := "" switch *s.cfg.ParentType { - case "kcp": - fallthrough - case "tcp": - fallthrough - case "tls": + case "kcp", "tcp", "tls": lbAddr, err = s.OutToTCP(&inConn) default: err = fmt.Errorf("unkown parent type %s", *s.cfg.ParentType) diff --git a/services/tcp/tcp.go b/services/tcp/tcp.go index 4f4c792..fc11695 100644 --- a/services/tcp/tcp.go +++ b/services/tcp/tcp.go @@ -160,11 +160,7 @@ func (s *TCP) callback(inConn net.Conn) { var err error lbAddr := "" switch *s.cfg.ParentType { - case "kcp": - fallthrough - case "tcp": - fallthrough - case "tls": + case "kcp", "tcp", "tls": err = s.OutToTCP(&inConn) case "udp": s.OutToUDP(&inConn) diff --git a/services/udp/udp.go b/services/udp/udp.go index d6b32dc..787bdd6 100644 --- a/services/udp/udp.go +++ b/services/udp/udp.go @@ -141,9 +141,7 @@ func (s *UDP) callback(listener *net.UDPConn, packet []byte, localAddr, srcAddr } }() switch *s.cfg.ParentType { - case "tcp": - fallthrough - case "tls": + case "tcp", "tls": s.OutToTCP(packet, localAddr, srcAddr) case "udp": s.OutToUDP(packet, localAddr, srcAddr) From 03ef384c480cfc25b94e0e5ca2052911c644f3e4 Mon Sep 17 00:00:00 2001 From: snail007 Date: Fri, 14 Sep 2018 11:37:06 +0800 Subject: [PATCH 3/3] Update install_auto.sh --- install_auto.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install_auto.sh b/install_auto.sh index 32bf059..5202b6b 100755 --- a/install_auto.sh +++ b/install_auto.sh @@ -5,7 +5,7 @@ if [ -e /tmp/proxy ]; then fi mkdir /tmp/proxy cd /tmp/proxy -wget https://github.com/snail007/goproxy/releases/download/v6.0/proxy-linux-amd64.tar.gz +wget https://github.com/snail007/goproxy/releases/download/v6.1/proxy-linux-amd64.tar.gz # #install proxy tar zxvf proxy-linux-amd64.tar.gz