Documentation ¶
Overview ¶
Package config provides helpers for working with darvaza.org/x/tls.Store objects.
Index ¶
- func AddCACerts(ctx context.Context, s tls.StoreX509Writer, roots string) (int, error)
- func AddCert(ctx context.Context, s tls.StoreX509Writer, cert string) error
- func AddCertPair(ctx context.Context, s tls.StoreX509Writer, key, cert string) error
- func AddPrivateKey(ctx context.Context, s tls.StoreX509Writer, key string) error
- func ImportCACerts(ctx context.Context, s tls.StoreX509Writer, src x509utils.CertPool) (int, error)
- func ImportCerts(ctx context.Context, s tls.StoreX509Writer, src x509utils.CertPool) (int, error)
- type Config
- func (cfg *Config) AddCACerts(ctx context.Context, out tls.StoreX509Writer, value string, ...) (int, error)
- func (cfg *Config) AddCert(ctx context.Context, out tls.StoreX509Writer, value string, ...) error
- func (cfg *Config) AddCertPair(ctx context.Context, out tls.StoreX509Writer, key, cert string, ...) error
- func (cfg *Config) AddPrivateKey(ctx context.Context, out tls.StoreX509Writer, key string, ...) error
- func (cfg *Config) Apply(ctx context.Context, s tls.StoreX509Writer) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddCACerts ¶
AddCACerts adds all given certificates as trusted roots to the given tls.Store. PEM content, a PEM fileName, or a directory containing PEM files.
func AddCertPair ¶
AddCertPair adds a cert-key pair to the specified tls.Store.
func AddPrivateKey ¶
AddPrivateKey adds a private key to the specified tls.Store.
func ImportCACerts ¶
ImportCACerts adds all CACerts in a given x509utils.CertPool to the specified tls.Store.
func ImportCerts ¶
ImportCerts adds all Certs in a given x509utils.CertPool to the specified tls.Store.
Types ¶
type Config ¶
type Config struct { Logger slog.Logger Roots []string Keys []string Certs []string Options []x509utils.ReadOption }
Config provides an easy way to populate a tls.Store
func (*Config) AddCACerts ¶
func (cfg *Config) AddCACerts(ctx context.Context, out tls.StoreX509Writer, value string, options ...x509utils.ReadOption) (int, error)
AddCACerts adds all given certificates as trusted roots to the given tls.Store. PEM content, a PEM fileName, or a directory containing PEM files.
func (*Config) AddCert ¶
func (cfg *Config) AddCert(ctx context.Context, out tls.StoreX509Writer, value string, options ...x509utils.ReadOption) error
AddCert adds all given certificates to the specified tls.Store.
func (*Config) AddCertPair ¶
func (cfg *Config) AddCertPair(ctx context.Context, out tls.StoreX509Writer, key, cert string, options ...x509utils.ReadOption) error
AddCertPair adds a cert-key pair to the specified tls.Store.
func (*Config) AddPrivateKey ¶
func (cfg *Config) AddPrivateKey(ctx context.Context, out tls.StoreX509Writer, key string, options ...x509utils.ReadOption) error
AddPrivateKey adds a private key to the specified tls.Store.