-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Expand file tree
/
Copy pathconfigprovider.go
More file actions
39 lines (32 loc) · 1.14 KB
/
configprovider.go
File metadata and controls
39 lines (32 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package aghtls
import (
"crypto/tls"
"crypto/x509"
)
// TLSConfigProvider provides TLS configuration to consumers. Implementations
// must be safe for concurrent use.
//
// TODO(m.kazantsev): Merge with the Manager interface.
// TODO(m.kazantsev): Add at least one real implementation.
type TLSConfigProvider interface {
// TLSConfig returns a clone of the current TLS configuration. conf
// provides its certificates via GetConfigForClient method.
TLSConfig() (conf *tls.Config)
// RootCAs returns the current root CA pool.
RootCAs() (root *x509.CertPool)
}
// type check
var _ TLSConfigProvider = EmptyTLSConfigProvider{}
// EmptyTLSConfigProvider is the implementation of the [TLSConfigProvider]
// interface that does nothing.
type EmptyTLSConfigProvider struct{}
// TLSConfig implements the [TLSConfigProvider] interface for
// EmptyTLSConfigProvider. It always returns nil.
func (EmptyTLSConfigProvider) TLSConfig() (conf *tls.Config) {
return nil
}
// RootCAs implements the [TLSConfigProvider] interface for
// EmptyTLSConfigProvider. It always returns nil.
func (EmptyTLSConfigProvider) RootCAs() (root *x509.CertPool) {
return nil
}