store

package
v0.20.1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package store provides various implementations of stores of TLS certificates that can be plugged into server libraries that accept tls.Config structs (e.g. the http and grpc packages).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ReloadingFileStore

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

ReloadingFileStore is a Store that will return the same tls.Certificate for all incoming TLS handshakes. The certificate is periodically regenerated by loading the key material from a well known path.

func NewReloadingFileStore

func NewReloadingFileStore(opts ReloadingFileStoreOpts) (*ReloadingFileStore, error)

NewReloadingFileStore returns a pointer to a new ReloadingFileStore.

func (*ReloadingFileStore) GetCertificateFunc

func (s *ReloadingFileStore) GetCertificateFunc() func(info *tls.ClientHelloInfo) (*tls.Certificate, error)

GetCertificateFunc implements Store by returning a function that returns the currently cached value of the tls.Certificate.

func (*ReloadingFileStore) Run

Run starts the Store, performing an initial load of the tls.Certificate before entering the reload loop.

type ReloadingFileStoreOpts

type ReloadingFileStoreOpts struct {
	KeyPath        string
	CertPath       string
	ReloadInterval time.Duration
}

ReloadingFileStoreOpts are options for a ReloadingFileStore.

type Store

type Store interface {

	// GetCertificateFunc returns a function that will return the appropriate
	// tls.Certificate based on the incoming tls.ClientHelloInfo.
	GetCertificateFunc() func(info *tls.ClientHelloInfo) (*tls.Certificate, error)

	// Run starts the Store.
	Run(ctx context.Context) error
}

Store is a cache of tls.Certificates.

Jump to

Keyboard shortcuts

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