Add name to errors from v2ray HTTP transports

This commit is contained in:
世界 2024-07-01 23:19:42 +08:00
parent 8a17043502
commit 94707dfcdd
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
4 changed files with 4 additions and 4 deletions

View file

@ -100,7 +100,7 @@ func (c *Client) DialContext(ctx context.Context) (net.Conn, error) {
conn.setup(nil, err)
} else if response.StatusCode != 200 {
response.Body.Close()
conn.setup(nil, E.New("unexpected status: ", response.Status))
conn.setup(nil, E.New("v2ray-grpc: unexpected status: ", response.Status))
} else {
conn.setup(response.Body, nil)
}

View file

@ -146,7 +146,7 @@ func (c *Client) dialHTTP2(ctx context.Context) (net.Conn, error) {
conn.Setup(nil, err)
} else if response.StatusCode != 200 {
response.Body.Close()
conn.Setup(nil, E.New("unexpected status: ", response.Status))
conn.Setup(nil, E.New("v2ray-http: unexpected status: ", response.Status))
} else {
conn.Setup(response.Body, nil)
}

View file

@ -43,7 +43,7 @@ func (c *HTTPConn) Read(b []byte) (n int, err error) {
return 0, E.Cause(err, "read response")
}
if response.StatusCode != 200 {
return 0, E.New("unexpected status: ", response.Status)
return 0, E.New("v2ray-http: unexpected status: ", response.Status)
}
if cacheLen := reader.Buffered(); cacheLen > 0 {
c.responseCache = buf.NewSize(cacheLen)

View file

@ -104,7 +104,7 @@ func (c *Client) DialContext(ctx context.Context) (net.Conn, error) {
if response.StatusCode != 101 ||
!strings.EqualFold(response.Header.Get("Connection"), "upgrade") ||
!strings.EqualFold(response.Header.Get("Upgrade"), "websocket") {
return nil, E.New("unexpected status: ", response.Status)
return nil, E.New("v2ray-http-upgrade: unexpected status: ", response.Status)
}
if bufReader.Buffered() > 0 {
buffer := buf.NewSize(bufReader.Buffered())