certsource

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCacheRoot         = `.tmp/certs`
	CachedFileKeyCertificate = `cert`
	CachedFileKeyPrivateKey  = `key`
	CachedFileKeyCA          = `ca`
)

Variables

This section is empty.

Functions

func ParseConfigWithDefaults

func ParseConfigWithDefaults[T any](defaults T, rawConfig json.RawMessage) (T, error)

func ParseTLSVersion

func ParseTLSVersion(verStr string) (uint16, error)

func RenewRepeatIntervalFunc

func RenewRepeatIntervalFunc(fallbackInterval time.Duration) loop.RepeatIntervalFunc

RenewRepeatIntervalFunc create a loop.RepeatIntervalFunc for renewing certificate. The interval is set to the half way between now and cached certificate expiration. If "fallbackInterval" is provided, it is used for any error cases

Types

type FileCache

type FileCache struct {
	Dir    string
	Prefix string
}

func NewFileCache

func NewFileCache(opts ...FileCacheOptions) (*FileCache, error)

func (*FileCache) CacheCertificate

func (c *FileCache) CacheCertificate(cert *tls.Certificate) error

CacheCertificate will write out a cert and key to files based on configured path and prefix

func (*FileCache) CachePEM

func (c *FileCache) CachePEM(pemData []byte, key string) error

CachePEM write given data into file. The file name is determined by "key" and "suffix"

func (*FileCache) ResolvePath

func (c *FileCache) ResolvePath(key string) string

type FileCacheOption

type FileCacheOption struct {
	Root   string
	Type   certs.SourceType
	Prefix string
}

type FileCacheOptions

type FileCacheOptions func(opt *FileCacheOption)

type GenericFactory

type GenericFactory[PropertiesType any] struct {
	SourceType  certs.SourceType
	Defaults    PropertiesType
	Constructor func(props PropertiesType) certs.Source
}

func NewFactory

func NewFactory[PropertiesType any](typ certs.SourceType, rawDefaultConfig json.RawMessage, constructor func(props PropertiesType) certs.Source) (*GenericFactory[PropertiesType], error)

func (*GenericFactory[T]) LoadAndInit

func (f *GenericFactory[T]) LoadAndInit(_ context.Context, opts ...certs.SourceOptions) (certs.Source, error)

func (*GenericFactory[T]) Type

func (f *GenericFactory[T]) Type() certs.SourceType

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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