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

Function NewServerCreds

security/advancedtls/advancedtls.go:623–638  ·  security/advancedtls/advancedtls.go::NewServerCreds

NewServerCreds uses ServerOptions to construct a TransportCredentials based on TLS.

(o *Options)

Source from the content-addressed store, hash-verified

621// NewServerCreds uses ServerOptions to construct a TransportCredentials based
622// on TLS.
623func NewServerCreds(o *Options) (credentials.TransportCredentials, error) {
624 conf, err := o.serverConfig()
625 if err != nil {
626 return nil, err
627 }
628 tc := &advancedTLSCreds{
629 config: conf,
630 isClient: false,
631 getRootCertificates: o.RootOptions.GetRootCertificates,
632 verifyFunc: o.AdditionalPeerVerification,
633 revocationOptions: o.RevocationOptions,
634 verificationType: o.VerificationType,
635 }
636 tc.config.NextProtos = credinternal.AppendH2ToNextProtos(tc.config.NextProtos)
637 return tc, nil
638}

Callers 7

mainFunction · 0.92
createAndRunTLSServerFunction · 0.92
TestEnd2EndMethod · 0.70
TestTLSVersionsMethod · 0.70

Calls 1

serverConfigMethod · 0.80

Tested by 5

TestEnd2EndMethod · 0.56
TestTLSVersionsMethod · 0.56