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:
@@ -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")))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user