mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-25 18:11:28 +00:00
Fix grpc request
This commit is contained in:
parent
6ce4e31fc8
commit
e8dad1afeb
|
@ -34,6 +34,7 @@ type Client struct {
|
||||||
transport *http2.Transport
|
transport *http2.Transport
|
||||||
options option.V2RayGRPCOptions
|
options option.V2RayGRPCOptions
|
||||||
url *url.URL
|
url *url.URL
|
||||||
|
host string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewClient(ctx context.Context, dialer N.Dialer, serverAddr M.Socksaddr, options option.V2RayGRPCOptions, tlsConfig tls.Config) adapter.V2RayClientTransport {
|
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{
|
url: &url.URL{
|
||||||
Scheme: "https",
|
Scheme: "https",
|
||||||
Host: host,
|
Host: serverAddr.String(),
|
||||||
Path: "/" + options.ServiceName + "/Tun",
|
Path: "/" + options.ServiceName + "/Tun",
|
||||||
RawPath: "/" + url.PathEscape(options.ServiceName) + "/Tun",
|
RawPath: "/" + url.PathEscape(options.ServiceName) + "/Tun",
|
||||||
},
|
},
|
||||||
|
host: host,
|
||||||
}
|
}
|
||||||
|
|
||||||
if tlsConfig == nil {
|
if tlsConfig == nil {
|
||||||
|
@ -88,6 +90,7 @@ func (c *Client) DialContext(ctx context.Context) (net.Conn, error) {
|
||||||
Body: pipeInReader,
|
Body: pipeInReader,
|
||||||
URL: c.url,
|
URL: c.url,
|
||||||
Header: defaultClientHeader,
|
Header: defaultClientHeader,
|
||||||
|
Host: c.host,
|
||||||
}
|
}
|
||||||
request = request.WithContext(ctx)
|
request = request.WithContext(ctx)
|
||||||
conn := newLateGunConn(pipeInWriter)
|
conn := newLateGunConn(pipeInWriter)
|
||||||
|
|
Loading…
Reference in a new issue