letsencrypt

package
v0.22.1 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: Apache-2.0 Imports: 29 Imported by: ? 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

Overview

Package letsencrypt provides automatic TLS certificate management via Let's Encrypt using the ACME protocol. It supports both DNS-01 and HTTP-01 challenges.

Index

Constants

View Source
const (
	// ACME directory URLs
	LetsEncryptProduction = "https://acme-v02.api.letsencrypt.org/directory"
	LetsEncryptStaging    = "https://acme-staging-v02.api.letsencrypt.org/directory"

	// Default values
	DefaultRenewBeforeDays = 30
	DefaultHTTPPort        = 80
)

Variables

This section is empty.

Functions

func SupportedDNSProviders

func SupportedDNSProviders() []string

SupportedDNSProviders returns a list of supported DNS provider names

Types

type DNSCredentials

type DNSCredentials struct {
	// Cloudflare
	CloudflareAPIToken string `json:"cloudflare_api_token,omitempty"`
	CloudflareEmail    string `json:"cloudflare_email,omitempty"`
	CloudflareAPIKey   string `json:"cloudflare_api_key,omitempty"`

	// AWS Route53
	AWSAccessKeyID     string `json:"aws_access_key_id,omitempty"`
	AWSSecretAccessKey string `json:"aws_secret_access_key,omitempty"`
	AWSRegion          string `json:"aws_region,omitempty"`

	// DigitalOcean
	DigitalOceanToken string `json:"digitalocean_token,omitempty"`

	// GoDaddy
	GoDaddyAPIKey    string `json:"godaddy_api_key,omitempty"`
	GoDaddyAPISecret string `json:"godaddy_api_secret,omitempty"`

	// Namecheap
	NamecheapAPIUser string `json:"namecheap_api_user,omitempty"`
	NamecheapAPIKey  string `json:"namecheap_api_key,omitempty"`
}

DNSCredentials holds credentials for various DNS providers

type LegoLogger

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

LegoLogger adapts zerolog to lego's StdLogger interface

func NewLegoLogger

func NewLegoLogger(logger zerolog.Logger) *LegoLogger

NewLegoLogger creates a new lego-compatible logger wrapping zerolog

func (*LegoLogger) Fatal

func (l *LegoLogger) Fatal(args ...interface{})

Fatal logs a fatal message and exits

func (*LegoLogger) Fatalf

func (l *LegoLogger) Fatalf(format string, args ...interface{})

Fatalf logs a formatted fatal message and exits

func (*LegoLogger) Fatalln

func (l *LegoLogger) Fatalln(args ...interface{})

Fatalln logs a fatal message with newline and exits

func (*LegoLogger) Print

func (l *LegoLogger) Print(args ...interface{})

Print logs an info message

func (*LegoLogger) Printf

func (l *LegoLogger) Printf(format string, args ...interface{})

Printf logs a formatted info message

func (*LegoLogger) Println

func (l *LegoLogger) Println(args ...interface{})

Println logs an info message with newline

type Manager

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

Manager handles Let's Encrypt certificate acquisition and renewal

func NewManager

func NewManager(cfg config.LetsEncryptConfig, logger zerolog.Logger) (*Manager, error)

NewManager creates a new Let's Encrypt certificate manager

func (*Manager) CertPath

func (m *Manager) CertPath() string

CertPath returns the path to the certificate file

func (*Manager) EnsureCertificate

func (m *Manager) EnsureCertificate() error

EnsureCertificate ensures a valid certificate exists, obtaining one if necessary

func (*Manager) GetCertificate

func (m *Manager) GetCertificate(hello *tls.ClientHelloInfo) (*tls.Certificate, error)

GetCertificate returns the current TLS certificate for use with tls.Config.GetCertificate

func (*Manager) GetTLSConfig

func (m *Manager) GetTLSConfig() *tls.Config

GetTLSConfig returns a tls.Config configured to use Let's Encrypt certificates

func (*Manager) Initialize

func (m *Manager) Initialize() error

Initialize sets up the ACME client and registers the account

func (*Manager) KeyPath

func (m *Manager) KeyPath() string

KeyPath returns the path to the private key file

func (*Manager) ObtainCertificate

func (m *Manager) ObtainCertificate() error

ObtainCertificate obtains a new certificate for the configured domains

func (*Manager) RenewCertificate

func (m *Manager) RenewCertificate() error

RenewCertificate renews the current certificate if needed

func (*Manager) StartAutoRenewal

func (m *Manager) StartAutoRenewal(interval time.Duration)

StartAutoRenewal starts a background goroutine that checks for certificate renewal

func (*Manager) Stop

func (m *Manager) Stop()

Stop stops the auto-renewal goroutine

type User

type User struct {
	Email        string
	Registration *registration.Resource
	// contains filtered or unexported fields
}

User implements acme.User for lego

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

Jump to

Keyboard shortcuts

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