tls

package
v0.260331.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: MPL-2.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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