NewServerCreds uses ServerOptions to construct a TransportCredentials based on TLS.
(o *Options)
| 621 | // NewServerCreds uses ServerOptions to construct a TransportCredentials based |
| 622 | // on TLS. |
| 623 | func 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 | } |