mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-25 18:11:28 +00:00
Fix grpc lite request host
Co-authored-by: armv9 <48624112+arm64v8a@users.noreply.github.com>
This commit is contained in:
parent
e1d96cb64e
commit
d686172854
|
@ -36,6 +36,12 @@ type Client struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
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 {
|
||||||
|
var host string
|
||||||
|
if tlsConfig != nil && tlsConfig.ServerName() != "" {
|
||||||
|
host = M.ParseSocksaddrHostPort(tlsConfig.ServerName(), serverAddr.Port).String()
|
||||||
|
} else {
|
||||||
|
host = serverAddr.String()
|
||||||
|
}
|
||||||
client := &Client{
|
client := &Client{
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
dialer: dialer,
|
dialer: dialer,
|
||||||
|
@ -48,7 +54,7 @@ func NewClient(ctx context.Context, dialer N.Dialer, serverAddr M.Socksaddr, opt
|
||||||
},
|
},
|
||||||
url: &url.URL{
|
url: &url.URL{
|
||||||
Scheme: "https",
|
Scheme: "https",
|
||||||
Host: serverAddr.String(),
|
Host: host,
|
||||||
Path: "/" + options.ServiceName + "/Tun",
|
Path: "/" + options.ServiceName + "/Tun",
|
||||||
RawPath: "/" + url.PathEscape(options.ServiceName) + "/Tun",
|
RawPath: "/" + url.PathEscape(options.ServiceName) + "/Tun",
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue