Skip to content

Commit

Permalink
Fix small lint problem
Browse files Browse the repository at this point in the history
  • Loading branch information
9seconds committed Jul 9, 2018
1 parent 0a3dca9 commit ce8168b
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,34 +55,34 @@ func (p *Proxy) accept(conn net.Conn) {

log.Infow("Client connected", "addr", conn.RemoteAddr())

client, opts, err := p.clientInit(conn, connID, p.conf)
clientConn, opts, err := p.clientInit(conn, connID, p.conf)
if err != nil {
log.Errorw("Cannot initialize client connection", "error", err)
return
}
defer client.(io.Closer).Close() // nolint: errcheck
defer clientConn.(io.Closer).Close() // nolint: errcheck

stats.ClientConnected(opts.ConnectionType, client.RemoteAddr())
defer stats.ClientDisconnected(opts.ConnectionType, client.RemoteAddr())
stats.ClientConnected(opts.ConnectionType, clientConn.RemoteAddr())
defer stats.ClientDisconnected(opts.ConnectionType, clientConn.RemoteAddr())

server, err := p.getTelegramConn(opts, connID)
serverConn, err := p.getTelegramConn(opts, connID)
if err != nil {
log.Errorw("Cannot initialize server connection", "error", err)
return
}
defer server.(io.Closer).Close() // nolint: errcheck
defer serverConn.(io.Closer).Close() // nolint: errcheck

wait := &sync.WaitGroup{}
wait.Add(2)

if p.conf.UseMiddleProxy() {
clientPacket := client.(wrappers.PacketReadWriteCloser)
serverPacket := server.(wrappers.PacketReadWriteCloser)
clientPacket := clientConn.(wrappers.PacketReadWriteCloser)
serverPacket := serverConn.(wrappers.PacketReadWriteCloser)
go p.middlePipe(clientPacket, serverPacket, wait, &opts.ReadHacks)
go p.middlePipe(serverPacket, clientPacket, wait, &opts.WriteHacks)
} else {
clientStream := client.(wrappers.StreamReadWriteCloser)
serverStream := server.(wrappers.StreamReadWriteCloser)
clientStream := clientConn.(wrappers.StreamReadWriteCloser)
serverStream := serverConn.(wrappers.StreamReadWriteCloser)
go p.directPipe(clientStream, serverStream, wait)
go p.directPipe(serverStream, clientStream, wait)
}
Expand Down

0 comments on commit ce8168b

Please sign in to comment.