From e8dad1afeb5020353c43cc5a2bdb6e8cc81fc981 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Sat, 22 Apr 2023 19:50:20 +0800 Subject: [PATCH] Fix grpc request --- transport/v2raygrpclite/client.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/transport/v2raygrpclite/client.go b/transport/v2raygrpclite/client.go index 31461d33..8480ac53 100644 --- a/transport/v2raygrpclite/client.go +++ b/transport/v2raygrpclite/client.go @@ -34,6 +34,7 @@ type Client struct { transport *http2.Transport options option.V2RayGRPCOptions url *url.URL + host string } func NewClient(ctx context.Context, dialer N.Dialer, serverAddr M.Socksaddr, options option.V2RayGRPCOptions, tlsConfig tls.Config) adapter.V2RayClientTransport { @@ -55,10 +56,11 @@ func NewClient(ctx context.Context, dialer N.Dialer, serverAddr M.Socksaddr, opt }, url: &url.URL{ Scheme: "https", - Host: host, + Host: serverAddr.String(), Path: "/" + options.ServiceName + "/Tun", RawPath: "/" + url.PathEscape(options.ServiceName) + "/Tun", }, + host: host, } if tlsConfig == nil { @@ -88,6 +90,7 @@ func (c *Client) DialContext(ctx context.Context) (net.Conn, error) { Body: pipeInReader, URL: c.url, Header: defaultClientHeader, + Host: c.host, } request = request.WithContext(ctx) conn := newLateGunConn(pipeInWriter)