certreload

package
v1.20.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateCertExpiry

func ValidateCertExpiry(certPEM []byte, now time.Time) error

ValidateCertExpiry validates the certificate expiry.

Types

type CertReloadConfig

type CertReloadConfig struct {
	// CertKeyGetter gets the certificate and the private key.
	CertKeyGetter func() ([]byte, []byte, error)
	Logger        func(fmt string, args ...interface{})
	PollInterval  time.Duration
}

CertReloadConfig contains the config for cert reload.

type MemCertReloader

type MemCertReloader struct {
	// contains filtered or unexported fields
}

MemCertReloader reloads the (key, cert) pair by invoking the callback functions getter.

func NewCertReloader

func NewCertReloader(config CertReloadConfig) (*MemCertReloader, error)

NewCertReloader returns a MemCertReloader that reloads the (key, cert) pair whenever the cert file changes on the filesystem.

func (*MemCertReloader) Close

func (w *MemCertReloader) Close() error

Close stops the background refresh.

func (*MemCertReloader) GetCertificate

func (w *MemCertReloader) GetCertificate(*tls.ClientHelloInfo) (*tls.Certificate, error)

GetCertificate returns the latest known certificate and can be assigned to the GetCertificate member of the TLS config. For http.server use.

func (*MemCertReloader) GetClientCertificate

func (w *MemCertReloader) GetClientCertificate(*tls.CertificateRequestInfo) (*tls.Certificate, error)

GetClientCertificate returns the latest known certificate and can be assigned to the GetClientCertificate member of the TLS config. For http.client use.

func (*MemCertReloader) GetLatestCertificate

func (w *MemCertReloader) GetLatestCertificate() (*tls.Certificate, error)

GetLatestCertificate returns the latest known certificate.

func (*MemCertReloader) Reload

func (w *MemCertReloader) Reload() error

Reload reloads the certificate into the memory cache when the certificate is updated and valid.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL