diff --git a/transport/v2rayhttp/client.go b/transport/v2rayhttp/client.go index 08bb0e87..4d660fef 100644 --- a/transport/v2rayhttp/client.go +++ b/transport/v2rayhttp/client.go @@ -139,16 +139,16 @@ func (c *Client) dialHTTP2(ctx context.Context) (net.Conn, error) { default: request.Host = c.host[rand.Intn(hostLen)] } - conn := newLateHTTPConn(pipeInWriter) + conn := NewLateHTTPConn(pipeInWriter) go func() { response, err := c.transport.RoundTrip(request) if err != nil { - conn.setup(nil, err) + conn.Setup(nil, err) } else if response.StatusCode != 200 { response.Body.Close() - conn.setup(nil, E.New("unexpected status: ", response.StatusCode, " ", response.Status)) + conn.Setup(nil, E.New("unexpected status: ", response.StatusCode, " ", response.Status)) } else { - conn.setup(response.Body, nil) + conn.Setup(response.Body, nil) } }() return conn, nil diff --git a/transport/v2rayhttp/conn.go b/transport/v2rayhttp/conn.go index fc0f6501..3e1716d1 100644 --- a/transport/v2rayhttp/conn.go +++ b/transport/v2rayhttp/conn.go @@ -140,14 +140,14 @@ func NewHTTPConn(reader io.Reader, writer io.Writer) HTTP2Conn { } } -func newLateHTTPConn(writer io.Writer) *HTTP2Conn { +func NewLateHTTPConn(writer io.Writer) *HTTP2Conn { return &HTTP2Conn{ create: make(chan struct{}), writer: writer, } } -func (c *HTTP2Conn) setup(reader io.Reader, err error) { +func (c *HTTP2Conn) Setup(reader io.Reader, err error) { c.reader = reader c.err = err close(c.create)