tls

package
v0.260409.1540 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CertValidity is the certificate validity period
	CertValidity = 365 * 24 * time.Hour // 1 year
	// KeySize is the RSA key size
	KeySize = 2048
)

Variables

View Source
var (
	// DefaultDNSNames are the default DNS names for the certificate
	DefaultDNSNames = []string{"localhost", "127.0.0.1"}
)

Functions

func GetDefaultCertDir

func GetDefaultCertDir(configDir string) string

GetDefaultCertDir returns the default certificate directory

Types

type CertificateGenerator

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

CertificateGenerator handles self-signed certificate generation

func NewCertificateGenerator

func NewCertificateGenerator(certDir string) *CertificateGenerator

NewCertificateGenerator creates a new generator

func (*CertificateGenerator) EnsureCertificates

func (g *CertificateGenerator) EnsureCertificates(regenerate bool) error

EnsureCertificates ensures certificates exist and are valid

func (*CertificateGenerator) Exists

func (g *CertificateGenerator) Exists() bool

Exists checks if certificate files exist

func (*CertificateGenerator) Generate

func (g *CertificateGenerator) Generate() error

Generate generates a new self-signed certificate

func (*CertificateGenerator) GetCertFile

func (g *CertificateGenerator) GetCertFile() string

GetCertFile returns the certificate file path

func (*CertificateGenerator) GetKeyFile

func (g *CertificateGenerator) GetKeyFile() string

GetKeyFile returns the private key file path

func (*CertificateGenerator) Load

Load loads existing certificate info

func (*CertificateGenerator) ShouldRegenerate

func (g *CertificateGenerator) ShouldRegenerate() bool

ShouldRegenerate checks if certificate should be regenerated

type CertificateInfo

type CertificateInfo struct {
	NotBefore time.Time `json:"not_before"`
	NotAfter  time.Time `json:"not_after"`
	Subject   string    `json:"subject"`
	DNSNames  []string  `json:"dns_names"`
}

CertificateInfo holds generated certificate metadata

type TLSConfig

type TLSConfig struct {
	Enabled    bool   `json:"enabled" yaml:"enabled"`
	CertDir    string `json:"cert_dir" yaml:"cert_dir"`
	CertFile   string `json:"cert_file" yaml:"cert_file"`
	KeyFile    string `json:"key_file" yaml:"key_file"`
	Regenerate bool   `json:"regenerate" yaml:"regenerate"`
}

TLSConfig holds TLS-related configuration

Jump to

Keyboard shortcuts

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