NewClientCreds uses ClientOptions to construct a TransportCredentials based on TLS.
(o *Options)
| 602 | // NewClientCreds uses ClientOptions to construct a TransportCredentials based |
| 603 | // on TLS. |
| 604 | func 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. |