ca

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CAManager

type CAManager struct {
	CADir  string
	CACert *x509.Certificate
	CAKey  crypto.PrivateKey
}

CAManager generates and manages a local CA certificate used for TLS interception.

func NewCAManager

func NewCAManager(caDir string) (*CAManager, error)

NewCAManager creates a CAManager for the given directory and ensures the CA certificate and key are available (generating them if necessary).

func (*CAManager) CertPath

func (m *CAManager) CertPath() string

CertPath returns the filesystem path to the CA certificate file.

func (*CAManager) GenerateServerCert

func (m *CAManager) GenerateServerCert(host string) (*tls.Certificate, error)

GenerateServerCert creates a TLS leaf certificate for the given hostname, signed by the CA. The returned *tls.Certificate is ready for use in a tls.Config.

func (*CAManager) GetOrCreateCA

func (m *CAManager) GetOrCreateCA() error

GetOrCreateCA loads an existing CA cert and key from disk, or generates new ones if they do not exist.

Jump to

Keyboard shortcuts

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