Documentation ¶
Overview ¶
Package certman provides live reloading of the certificate and key files used by the standard library http.Server. It defines a type, certMan, with methods watching and getting the files. Only valid certificate and key pairs are loaded and an optional logger can be passed to certman for logging providing it implements the logger interface.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CertMan ¶ added in v0.2.0
type CertMan struct {
// contains filtered or unexported fields
}
A CertMan represents a certificate manager able to watch certificate and key pairs for changes.
func New ¶ added in v0.2.0
New creates a new certMan. The certFile and the keyFile are both paths to the location of the files. Relative and absolute paths are accepted.
func (*CertMan) GetCertificate ¶ added in v0.2.0
func (cm *CertMan) GetCertificate(hello *tls.ClientHelloInfo) (*tls.Certificate, error)
GetCertificate returns the loaded certificate for use by the GetCertificate field in tls.Config.
func (*CertMan) GetClientCertificate ¶ added in v0.3.2
func (cm *CertMan) GetClientCertificate(hello *tls.CertificateRequestInfo) (*tls.Certificate, error)
GetClientCertificate returns the loaded certificate for use by the GetClientCertificate field in tls.Config.
func (*CertMan) Logger ¶ added in v0.2.0
func (cm *CertMan) Logger(logger logger)
Logger sets the logger for certMan to use. It accepts a logger interface.
func (*CertMan) Stop ¶ added in v0.2.0
func (cm *CertMan) Stop()
Stop tells certMan to stop watching for changes to the certificate and key files.