autocert

package
v0.11.2-1 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2025 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProviderLocal  = "local"
	ProviderPseudo = "pseudo"
)
View Source
const (
	CertFileDefault    = certBasePath + "cert.crt"
	KeyFileDefault     = certBasePath + "priv.key"
	ACMEKeyFileDefault = certBasePath + "acme.key"
)

Variables

View Source
var (
	ErrMissingDomain   = gperr.New("missing field 'domains'")
	ErrMissingEmail    = gperr.New("missing field 'email'")
	ErrMissingProvider = gperr.New("missing field 'provider'")
	ErrInvalidDomain   = gperr.New("invalid domain")
	ErrUnknownProvider = gperr.New("unknown provider")
)
View Source
var ErrGetCertFailure = errors.New("get certificate failed")
View Source
var Providers = make(map[string]Generator)

Functions

This section is empty.

Types

type CertExpiries

type CertExpiries map[string]time.Time

type CertState

type CertState int
const (
	CertStateValid CertState = iota
	CertStateExpired
	CertStateMismatch
)

type Config added in v0.11.2

type Config struct {
	Email       string         `json:"email,omitempty"`
	Domains     []string       `json:"domains,omitempty"`
	CertPath    string         `json:"cert_path,omitempty"`
	KeyPath     string         `json:"key_path,omitempty"`
	ACMEKeyPath string         `json:"acme_key_path,omitempty"`
	Provider    string         `json:"provider,omitempty"`
	Options     map[string]any `json:"options,omitempty"`
}

func (*Config) GetLegoConfig added in v0.11.2

func (cfg *Config) GetLegoConfig() (*User, *lego.Config, gperr.Error)

func (*Config) LoadACMEKey added in v0.11.2

func (cfg *Config) LoadACMEKey() (*ecdsa.PrivateKey, error)

func (*Config) SaveACMEKey added in v0.11.2

func (cfg *Config) SaveACMEKey(key *ecdsa.PrivateKey) error

func (*Config) Validate added in v0.11.2

func (cfg *Config) Validate() gperr.Error

Validate implements the utils.CustomValidator interface.

type Generator added in v0.11.2

type Generator func(map[string]any) (challenge.Provider, gperr.Error)

func DNSProvider added in v0.11.2

func DNSProvider[CT any, PT challenge.Provider](
	defaultCfg func() *CT,
	newProvider func(*CT) (PT, error),
) Generator

type Provider

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

func NewProvider added in v0.11.2

func NewProvider(cfg *Config, user *User, legoCfg *lego.Config) *Provider

func (*Provider) GetCert

func (p *Provider) GetCert(_ *tls.ClientHelloInfo) (*tls.Certificate, error)

func (*Provider) GetCertPath

func (p *Provider) GetCertPath() string

func (*Provider) GetExpiries

func (p *Provider) GetExpiries() CertExpiries

func (*Provider) GetKeyPath

func (p *Provider) GetKeyPath() string

func (*Provider) GetName

func (p *Provider) GetName() string

func (*Provider) LoadCert

func (p *Provider) LoadCert() error

func (*Provider) ObtainCert

func (p *Provider) ObtainCert() error

func (*Provider) ScheduleRenewal

func (p *Provider) ScheduleRenewal(parent task.Parent)

func (*Provider) Setup

func (p *Provider) Setup() (err error)

func (*Provider) ShouldRenewOn

func (p *Provider) ShouldRenewOn() time.Time

ShouldRenewOn returns the time at which the certificate should be renewed.

type User

type User struct {
	Email        string
	Registration *registration.Resource
	Key          crypto.PrivateKey
}

func (*User) GetEmail

func (u *User) GetEmail() string

func (*User) GetPrivateKey

func (u *User) GetPrivateKey() crypto.PrivateKey

func (*User) GetRegistration

func (u *User) GetRegistration() *registration.Resource

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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