|
@@ -182,7 +182,7 @@ func parseEndpoint(endpoint string) (proto string, host string, scheme string) {
|
|
|
host = url.Host
|
|
host = url.Host
|
|
|
switch url.Scheme {
|
|
switch url.Scheme {
|
|
|
case "http", "https":
|
|
case "http", "https":
|
|
|
- case "unix":
|
|
|
|
|
|
|
+ case "unix", "unixs":
|
|
|
proto = "unix"
|
|
proto = "unix"
|
|
|
host = url.Host + url.Path
|
|
host = url.Host + url.Path
|
|
|
default:
|
|
default:
|
|
@@ -197,7 +197,7 @@ func (c *Client) processCreds(scheme string) (creds *credentials.TransportCreden
|
|
|
case "unix":
|
|
case "unix":
|
|
|
case "http":
|
|
case "http":
|
|
|
creds = nil
|
|
creds = nil
|
|
|
- case "https":
|
|
|
|
|
|
|
+ case "https", "unixs":
|
|
|
if creds != nil {
|
|
if creds != nil {
|
|
|
break
|
|
break
|
|
|
}
|
|
}
|
|
@@ -322,7 +322,7 @@ func (c *Client) dial(endpoint string, dopts ...grpc.DialOption) (*grpc.ClientCo
|
|
|
|
|
|
|
|
opts = append(opts, c.cfg.DialOptions...)
|
|
opts = append(opts, c.cfg.DialOptions...)
|
|
|
|
|
|
|
|
- conn, err := grpc.Dial(host, opts...)
|
|
|
|
|
|
|
+ conn, err := grpc.DialContext(c.ctx, host, opts...)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
return nil, err
|
|
return nil, err
|
|
|
}
|
|
}
|
|
@@ -367,7 +367,9 @@ func newClient(cfg *Config) (*Client, error) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
client.balancer = newSimpleBalancer(cfg.Endpoints)
|
|
client.balancer = newSimpleBalancer(cfg.Endpoints)
|
|
|
- conn, err := client.dial("", grpc.WithBalancer(client.balancer))
|
|
|
|
|
|
|
+ // use Endpoints[0] so that for https:// without any tls config given, then
|
|
|
|
|
+ // grpc will assume the ServerName is in the endpoint.
|
|
|
|
|
+ conn, err := client.dial(cfg.Endpoints[0], grpc.WithBalancer(client.balancer))
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
client.cancel()
|
|
client.cancel()
|
|
|
client.balancer.Close()
|
|
client.balancer.Close()
|