Documentation
¶
Index ¶
Constants ¶
View Source
const (
CertReloadMessage = "Certificate and/or key have changed on disk and were reloaded."
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CertWatcher ¶
type CertWatcher struct {
// contains filtered or unexported fields
}
CertWatcher watches certificate and key files and reloads them if they change on disk.
func NewCertWatcher ¶
func NewCertWatcher(certPath, keyPath string, reloadInterval time.Duration, logger *zap.SugaredLogger) (*CertWatcher, error)
NewCertWatcher creates a CertWatcher and watches the certificate and key files. It reloads the contents on file change. Make sure to stop the CertWatcher using Stop() upon destroy.
func (*CertWatcher) GetCertificate ¶
func (cw *CertWatcher) GetCertificate(_ *tls.ClientHelloInfo) (*tls.Certificate, error)
GetCertificate returns the server certificate for a client-hello request.
func (*CertWatcher) Stop ¶
func (cw *CertWatcher) Stop()
Stop shuts down the CertWatcher. Use this with `defer`.
Click to show internal directories.
Click to hide internal directories.