1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-02-01 05:45:23 -05:00

fix lint errors

This commit is contained in:
Darien Raymond
2018-04-11 16:15:29 +02:00
parent 044c641d7b
commit 9d7f43a299
11 changed files with 87 additions and 66 deletions

View File

@@ -116,8 +116,7 @@ Start:
if len(s.config.Accounts) > 0 {
user, pass, ok := parseBasicAuth(request.Header.Get("Proxy-Authorization"))
if !ok || !s.config.HasAccount(user, pass) {
_, err := conn.Write([]byte("HTTP/1.1 407 Proxy Authentication Required\r\nProxy-Authenticate: Basic realm=\"proxy\"\r\n\r\n"))
return err
return common.Error2(conn.Write([]byte("HTTP/1.1 407 Proxy Authentication Required\r\nProxy-Authenticate: Basic realm=\"proxy\"\r\n\r\n")))
}
}

View File

@@ -138,8 +138,7 @@ func WriteTCPRequest(request *protocol.RequestHeader, writer io.Writer) (buf.Wri
if account.Cipher.IVSize() > 0 {
iv = make([]byte, account.Cipher.IVSize())
common.Must2(rand.Read(iv))
_, err = writer.Write(iv)
if err != nil {
if _, err = writer.Write(iv); err != nil {
return nil, newError("failed to write IV")
}
}
@@ -186,8 +185,7 @@ func ReadTCPResponse(user *protocol.User, reader io.Reader) (buf.Reader, error)
var iv []byte
if account.Cipher.IVSize() > 0 {
iv = make([]byte, account.Cipher.IVSize())
_, err = io.ReadFull(reader, iv)
if err != nil {
if _, err = io.ReadFull(reader, iv); err != nil {
return nil, newError("failed to read IV").Base(err)
}
}
@@ -207,8 +205,7 @@ func WriteTCPResponse(request *protocol.RequestHeader, writer io.Writer) (buf.Wr
if account.Cipher.IVSize() > 0 {
iv = make([]byte, account.Cipher.IVSize())
common.Must2(rand.Read(iv))
_, err = writer.Write(iv)
if err != nil {
if _, err = writer.Write(iv); err != nil {
return nil, newError("failed to write IV.").Base(err)
}
}

View File

@@ -122,8 +122,7 @@ func (s *Server) processTCP(ctx context.Context, conn internet.Connection, dispa
func (*Server) handleUDP(c io.Reader) error {
// The TCP connection closes after this method returns. We need to wait until
// the client closes it.
_, err := io.Copy(buf.DiscardBytes, c)
return err
return common.Error2(io.Copy(buf.DiscardBytes, c))
}
func (s *Server) transport(ctx context.Context, reader io.Reader, writer io.Writer, dest net.Destination, dispatcher core.Dispatcher) error {