mirror of
https://github.com/fullstorydev/grpcurl.git
synced 2026-05-22 19:51:44 +03:00
Support SSLKEYLOGFILE environment variable for key logging (#245)
This commit is contained in:
20
grpcurl.go
20
grpcurl.go
@@ -508,11 +508,25 @@ func makeTemplate(md *desc.MessageDescriptor, path []*desc.MessageDescriptor) pr
|
||||
return dm
|
||||
}
|
||||
|
||||
// ClientTransportCredentials builds transport credentials for a gRPC client using the
|
||||
// ClientTransportCredentials is a helper function that constructs a TLS config with
|
||||
// the given properties (see ClientTLSConfig) and then constructs and returns gRPC
|
||||
// transport credentials using that config.
|
||||
//
|
||||
// Deprecated: Use grpcurl.ClientTLSConfig and credentials.NewTLS instead.
|
||||
func ClientTransportCredentials(insecureSkipVerify bool, cacertFile, clientCertFile, clientKeyFile string) (credentials.TransportCredentials, error) {
|
||||
tlsConf, err := ClientTLSConfig(insecureSkipVerify, cacertFile, clientCertFile, clientKeyFile)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return credentials.NewTLS(tlsConf), nil
|
||||
}
|
||||
|
||||
// ClientTLSConfig builds transport-layer config for a gRPC client using the
|
||||
// given properties. If cacertFile is blank, only standard trusted certs are used to
|
||||
// verify the server certs. If clientCertFile is blank, the client will not use a client
|
||||
// certificate. If clientCertFile is not blank then clientKeyFile must not be blank.
|
||||
func ClientTransportCredentials(insecureSkipVerify bool, cacertFile, clientCertFile, clientKeyFile string) (credentials.TransportCredentials, error) {
|
||||
func ClientTLSConfig(insecureSkipVerify bool, cacertFile, clientCertFile, clientKeyFile string) (*tls.Config, error) {
|
||||
var tlsConf tls.Config
|
||||
|
||||
if clientCertFile != "" {
|
||||
@@ -542,7 +556,7 @@ func ClientTransportCredentials(insecureSkipVerify bool, cacertFile, clientCertF
|
||||
tlsConf.RootCAs = certPool
|
||||
}
|
||||
|
||||
return credentials.NewTLS(&tlsConf), nil
|
||||
return &tlsConf, nil
|
||||
}
|
||||
|
||||
// ServerTransportCredentials builds transport credentials for a gRPC server using the
|
||||
|
||||
Reference in New Issue
Block a user