Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var NewCertWatcherFunc = NewCertWatcher
Functions ¶
This section is empty.
Types ¶
type CertWatcher ¶ added in v1.300049.0
CertWatcher watches certificate and key files for changes. When either file changes, it reads and parses both and calls an optional callback with the new certificate.
func NewCertWatcher ¶ added in v1.300049.0
func NewCertWatcher(certPath, keyPath, caPath string, logger *zap.Logger) (*CertWatcher, error)
NewCertWatcher returns a new CertWatcher watching the given server certificate and client certificate.
func (*CertWatcher) GetTLSConfig ¶ added in v1.300049.0
func (cw *CertWatcher) GetTLSConfig() *tls.Config
GetTLSConfig fetches the currently loaded tls Config, which may be nil.
func (*CertWatcher) ReadTlsConfig ¶ added in v1.300049.0
func (cw *CertWatcher) ReadTlsConfig() error
func (*CertWatcher) RegisterCallback ¶ added in v1.300049.0
func (cw *CertWatcher) RegisterCallback(callback func())
RegisterCallback registers a callback to be invoked when the certificate changes.
func (*CertWatcher) Start ¶ added in v1.300049.0
func (cw *CertWatcher) Start(ctx context.Context) error
Start starts the watch on the certificate and key files.
func (*CertWatcher) Watch ¶ added in v1.300049.0
func (cw *CertWatcher) Watch()
Watch reads events from the watcher's channel and reacts to changes.
type ClientConfig ¶
type ClientConfig struct { TLSCA string `toml:"tls_ca"` TLSCert string `toml:"tls_cert"` TLSKey string `toml:"tls_key"` InsecureSkipVerify bool `toml:"insecure_skip_verify"` // Deprecated in 1.7; use TLS variables above SSLCA string `toml:"ssl_ca"` SSLCert string `toml:"ssl_cert"` SSLKey string `toml:"ssl_key"` }
ClientConfig represents the standard client TLS config.
type ServerConfig ¶
type ServerConfig struct { TLSCert string `toml:"tls_cert"` TLSKey string `toml:"tls_key"` TLSAllowedCACerts []string `toml:"tls_allowed_cacerts"` }
ServerConfig represents the standard server TLS config.