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

Function newProvider

credentials/tls/certprovider/pemfile/watcher.go:109–126  ·  view source on GitHub ↗

newProvider is used to create a new certificate provider plugin after validating the options, and hence does not return an error.

(o Options)

Source from the content-addressed store, hash-verified

107// newProvider is used to create a new certificate provider plugin after
108// validating the options, and hence does not return an error.
109func newProvider(o Options) certprovider.Provider {
110 if o.RefreshDuration == 0 {
111 o.RefreshDuration = defaultCertRefreshDuration
112 }
113
114 provider := &watcher{opts: o}
115 if o.CertFile != "" && o.KeyFile != "" {
116 provider.identityDistributor = newDistributor()
117 }
118 if o.RootFile != "" || o.SPIFFEBundleMapFile != "" {
119 provider.rootDistributor = newDistributor()
120 }
121
122 ctx, cancel := context.WithCancel(context.Background())
123 provider.cancel = cancel
124 go provider.run(ctx)
125 return provider
126}
127
128// watcher is a certificate provider plugin that implements the
129// certprovider.Provider interface. It watches a set of certificate and key

Callers 2

ParseConfigMethod · 0.85
NewProviderFunction · 0.85

Calls 1

runMethod · 0.95

Tested by

no test coverage detected