livetls

package
v0.0.0-...-0253919 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2023 License: AGPL-3.0 Imports: 8 Imported by: 0

README

livetls

import go.pitz.tech/lib/livetls

Usage

func LoadCertPool
func LoadCertPool(ctx context.Context, cfg *Config) (*x509.CertPool, error)

LoadCertPool loads the x509 certificate authority pool.

func LoadCertificate
func LoadCertificate(ctx context.Context, cfg *Config) (*tls.Certificate, error)

LoadCertificate loads the certificate from the configured public/private key.

func New
func New(ctx context.Context, config Config) (*tls.Config, error)

New construct a tls.Config that will periodically reload the configured certificate.

type Config
type Config struct {
	Enable         bool          `json:"enable"          usage:"whether or not TLS should be enabled"`
	CertPath       string        `json:"cert_path"       usage:"where to locate certificates for communication"`
	CAFile         string        `json:"ca_file"         usage:"override the ca file name"      default:"ca.crt"`
	CertFile       string        `json:"cert_file"       usage:"override the cert file name"    default:"tls.crt"`
	KeyFile        string        `json:"key_file"        usage:"override the key file name"     default:"tls.key"`
	ReloadInterval time.Duration `json:"reload_interval" usage:"how often to reload the config" default:"5m"`
}

Config defines common configuration that can be used to LoadCertificates for encrypted communication.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadCertPool

func LoadCertPool(ctx context.Context, cfg *Config) (*x509.CertPool, error)

LoadCertPool loads the x509 certificate authority pool.

func LoadCertificate

func LoadCertificate(ctx context.Context, cfg *Config) (*tls.Certificate, error)

LoadCertificate loads the certificate from the configured public/private key.

func New

func New(ctx context.Context, config Config) (*tls.Config, error)

New construct a tls.Config that will periodically reload the configured certificate.

Types

type Config

type Config struct {
	Enable         bool          `json:"enable"          usage:"whether or not TLS should be enabled"`
	CertPath       string        `json:"cert_path"       usage:"where to locate certificates for communication"`
	CAFile         string        `json:"ca_file"         usage:"override the ca file name"      default:"ca.crt"`
	CertFile       string        `json:"cert_file"       usage:"override the cert file name"    default:"tls.crt"`
	KeyFile        string        `json:"key_file"        usage:"override the key file name"     default:"tls.key"`
	ReloadInterval time.Duration `json:"reload_interval" usage:"how often to reload the config" default:"5m"`
}

Config defines common configuration that can be used to LoadCertificates for encrypted communication.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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