Documentation
¶
Index ¶
- Constants
- Variables
- func GetDefaultCertDir(configDir string) string
- type CertificateGenerator
- func (g *CertificateGenerator) EnsureCertificates(regenerate bool) error
- func (g *CertificateGenerator) Exists() bool
- func (g *CertificateGenerator) Generate() error
- func (g *CertificateGenerator) GetCertFile() string
- func (g *CertificateGenerator) GetKeyFile() string
- func (g *CertificateGenerator) Load() (*CertificateInfo, error)
- func (g *CertificateGenerator) ShouldRegenerate() bool
- type CertificateInfo
- type TLSConfig
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 ¶
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 ¶
func (g *CertificateGenerator) Load() (*CertificateInfo, error)
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
Click to show internal directories.
Click to hide internal directories.