Only enable xds credentials if the target is an xDS target
This commit is contained in:
parent
0620352c14
commit
14ea019627
11
grpcurl.go
11
grpcurl.go
|
|
@ -635,9 +635,14 @@ func BlockingDial(ctx context.Context, network, address string, creds credential
|
|||
}
|
||||
|
||||
var err error
|
||||
creds, err = xdsCredentials.NewClientCredentials(xdsCredentials.ClientOptions{FallbackCreds: creds})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
if strings.HasPrefix(address, "xds:///") {
|
||||
// The xds:/// prefix is used to signal to the gRPC client to use an xDS server to resolve the
|
||||
// target. The relevant credentials will be automatically pulled from the GRPC_XDS_BOOTSTRAP or
|
||||
// GRPC_XDS_BOOTSTRAP_CONFIG env vars.
|
||||
creds, err = xdsCredentials.NewClientCredentials(xdsCredentials.ClientOptions{FallbackCreds: creds})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
dialer := func(ctx context.Context, address string) (net.Conn, error) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue