Documentation
¶
Overview ¶
Package certwatch watches TLS certificate files on disk and provides a hot-reloading GetCertificate callback for tls.Config.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
Watcher monitors TLS certificate files on disk and caches the loaded certificate in memory. It detects changes via fsnotify (with a polling fallback for filesystems like NFS that lack inotify support) and reloads the certificate pair automatically.
func NewWatcher ¶
NewWatcher creates a Watcher that monitors the given cert and key files. It performs an initial load of the certificate and returns an error if the initial load fails.
func (*Watcher) GetCertificate ¶
func (w *Watcher) GetCertificate(_ *tls.ClientHelloInfo) (*tls.Certificate, error)
GetCertificate returns the current in-memory certificate. It is safe for concurrent use and compatible with tls.Config.GetCertificate.