Lint: fix according to golangci-lint (#333)

This commit is contained in:
Loyalsoldier
2021-05-21 00:59:11 +08:00
committed by GitHub
parent 02ade3fa6c
commit 669467057c
3 changed files with 7 additions and 2 deletions
+1 -1
View File
@@ -72,7 +72,7 @@ func TestSocks(t *testing.T) {
noDelay: true,
}
target, err := tunnel.NewAddressFromAddr("tcp", util.EchoAddr)
common.Must(err)
s, _ := socks5.NewClassicServer(socksAddr.String(), "127.0.0.1", "", "", 0, 0)
s.Handle = &socks5.DefaultHandle{}
go s.RunTCPServer()
+3 -1
View File
@@ -52,13 +52,15 @@ func TestTrojan(t *testing.T) {
c, err := NewClient(clientCtx, tcpClient)
common.Must(err)
s, err := NewServer(serverCtx, tcpServer)
common.Must(err)
conn1, err := c.DialConn(&tunnel.Address{
DomainName: "example.com",
AddressType: tunnel.DomainName,
}, nil)
common.Must(err)
common.Must2(conn1.Write([]byte("87654321")))
conn2, err := s.AcceptConn(nil)
common.Must(err)
buf := [8]byte{}
conn2.Read(buf[:])
if !util.CheckConn(conn1, conn2) {
+3
View File
@@ -92,6 +92,9 @@ func (s *Server) AcceptConn(tunnel.Tunnel) (tunnel.Conn, error) {
url := "wss://" + s.hostname + s.path
origin := "https://" + s.hostname
wsConfig, err := websocket.NewConfig(url, origin)
if err != nil {
return nil, common.NewError("failed to create websocket config").Base(err)
}
var wsConn *websocket.Conn
ctx, cancel := context.WithCancel(s.ctx)