acme

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 25 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChallengeFQDN

func ChallengeFQDN(domain string) string

ChallengeFQDN returns the full DNS name for a dns-01 challenge. E.g. for domain "example.com" returns "_acme-challenge.example.com".

Types

type CloudflareProvider

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

CloudflareProvider manages DNS TXT records via the Cloudflare API.

func NewCloudflareProvider

func NewCloudflareProvider(apiToken string) *CloudflareProvider

NewCloudflareProvider creates a provider using a Cloudflare API token. The token needs Zone:DNS:Edit and Zone:Zone:Read permissions.

func (*CloudflareProvider) CleanUp

func (p *CloudflareProvider) CleanUp(ctx context.Context, fqdn string) error

CleanUp removes the TXT record previously created by Present.

func (*CloudflareProvider) Present

func (p *CloudflareProvider) Present(ctx context.Context, fqdn, value string) error

Present creates a TXT record for the ACME dns-01 challenge.

type DNS01Options

type DNS01Options struct {
	// PropagationTimeout is the maximum time to wait for DNS propagation.
	// Defaults to 120 seconds.
	PropagationTimeout time.Duration

	// PollingInterval is how often to check for DNS propagation.
	// Defaults to 5 seconds.
	PollingInterval time.Duration

	// Resolver controls TXT propagation lookups. Nil uses vmflow's automatic
	// system-first failover policy.
	Resolver *dnsresolver.Resolver
}

DNS01Options configures DNS-01 challenge behavior.

type DNS01Solver

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

DNS01Solver wraps a DNSProvider to solve dns-01 challenges. It handles record provisioning and DNS propagation waiting.

func NewDNS01Solver

func NewDNS01Solver(provider DNSProvider, opts DNS01Options) *DNS01Solver

NewDNS01Solver creates a DNS-01 challenge solver backed by the given provider.

func (*DNS01Solver) CleanUp

func (s *DNS01Solver) CleanUp(ctx context.Context, fqdn string) error

CleanUp removes the DNS TXT record after the challenge is complete.

func (*DNS01Solver) Present

func (s *DNS01Solver) Present(ctx context.Context, fqdn, value string) error

Present adds the DNS TXT record for the challenge. fqdn should be "_acme-challenge.<domain>".

func (*DNS01Solver) PropagationWait

func (s *DNS01Solver) PropagationWait(ctx context.Context, fqdn, expectedValue string) error

PropagationWait polls DNS until the TXT record is visible or timeout.

type DNSProvider

type DNSProvider interface {
	// Present adds a TXT record with the given value under the given FQDN.
	Present(ctx context.Context, fqdn, value string) error

	// CleanUp removes the TXT record previously added by Present.
	CleanUp(ctx context.Context, fqdn string) error
}

DNSProvider sets and removes DNS TXT records for ACME dns-01 challenges.

type ExecProvider

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

ExecProvider manages DNS TXT records by calling an external script.

The script is called with:

present <fqdn> <value>   — create the TXT record
cleanup <fqdn>           — remove the TXT record

Exit code 0 = success, non-zero = failure. stdout/stderr are captured for error reporting.

func NewExecProvider

func NewExecProvider(path string) *ExecProvider

NewExecProvider creates a provider that delegates to an external script.

func (*ExecProvider) CleanUp

func (p *ExecProvider) CleanUp(ctx context.Context, fqdn string) error

CleanUp calls the script with "cleanup <fqdn>".

func (*ExecProvider) Present

func (p *ExecProvider) Present(ctx context.Context, fqdn, value string) error

Present calls the script with "present <fqdn> <value>".

type HTTP01Solver

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

func NewHTTP01Solver

func NewHTTP01Solver(addr string) *HTTP01Solver

func (*HTTP01Solver) CleanUp

func (s *HTTP01Solver) CleanUp(ctx context.Context, token string) error

func (*HTTP01Solver) Present

func (s *HTTP01Solver) Present(ctx context.Context, token, response string) error

func (*HTTP01Solver) Start

func (s *HTTP01Solver) Start(ctx context.Context) error

type Manager

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

func NewManager

func NewManager(cacheDir string, solver *HTTP01Solver) *Manager

func NewManagerWithDNS

func NewManagerWithDNS(cacheDir string, dnsSolver *DNS01Solver) *Manager

NewManagerWithDNS creates a Manager that uses dns-01 challenges.

func (*Manager) GetCertificate

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

GetCertificate returns a TLS certificate for the given SNI name.

func (*Manager) LoadedDomains

func (m *Manager) LoadedDomains() []string

LoadedDomains returns the domains currently cached in memory.

func (*Manager) Obtain

func (m *Manager) Obtain(ctx context.Context, domains []string) error

Obtain requests a certificate for the given domains via ACME.

func (*Manager) Preload

func (m *Manager) Preload(ctx context.Context)

Preload reads cached certificates from disk into memory. This allows GetCertificate to serve them without lazy-loading.

func (*Manager) RenewLoop

func (m *Manager) RenewLoop(ctx context.Context)

RenewLoop checks daily and renews certificates expiring within 30 days.

func (*Manager) SetOnObtain

func (m *Manager) SetOnObtain(fn func(domains []string))

SetOnObtain registers a callback invoked after a certificate is successfully obtained or renewed. The callback receives the list of domains.

Jump to

Keyboard shortcuts

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