MCPcopy
hub / github.com/grpc/grpc-go / NewClientCreds

Function NewClientCreds

security/advancedtls/advancedtls.go:604–619  ·  security/advancedtls/advancedtls.go::NewClientCreds

NewClientCreds uses ClientOptions to construct a TransportCredentials based on TLS.

(o *Options)

Source from the content-addressed store, hash-verified

602// NewClientCreds uses ClientOptions to construct a TransportCredentials based
603// on TLS.
604func NewClientCreds(o *Options) (credentials.TransportCredentials, error) {
605 conf, err := o.clientConfig()
606 if err != nil {
607 return nil, err
608 }
609 tc := &advancedTLSCreds{
610 config: conf,
611 isClient: true,
612 getRootCertificates: o.RootOptions.GetRootCertificates,
613 verifyFunc: o.AdditionalPeerVerification,
614 revocationOptions: o.RevocationOptions,
615 verificationType: o.VerificationType,
616 }
617 tc.config.NextProtos = credinternal.AppendH2ToNextProtos(tc.config.NextProtos)
618 return tc, nil
619}
620
621// NewServerCreds uses ServerOptions to construct a TransportCredentials based
622// on TLS.

Callers 9

mainFunction · 0.92
runClientWithProvidersFunction · 0.92
TestEnd2EndMethod · 0.70
TestTLSVersionsMethod · 0.70

Calls 1

clientConfigMethod · 0.80

Tested by 6

TestEnd2EndMethod · 0.56
TestTLSVersionsMethod · 0.56