mirror of
https://github.com/p4gefau1t/trojan-go.git
synced 2024-04-21 12:21:34 +00:00
Lint: fix according to golangci-lint (#333)
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user