Documentation
¶
Index ¶
- func ChallengeFQDN(domain string) string
- type CloudflareProvider
- type DNS01Options
- type DNS01Solver
- type DNSProvider
- type ExecProvider
- type HTTP01Solver
- type Manager
- func (m *Manager) GetCertificate(hello *tls.ClientHelloInfo) (*tls.Certificate, error)
- func (m *Manager) LoadedDomains() []string
- func (m *Manager) Obtain(ctx context.Context, domains []string) error
- func (m *Manager) Preload(ctx context.Context)
- func (m *Manager) RenewLoop(ctx context.Context)
- func (m *Manager) SetOnObtain(fn func(domains []string))
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChallengeFQDN ¶
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.
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
}
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.
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
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 ¶
LoadedDomains returns the domains currently cached in memory.
func (*Manager) Preload ¶
Preload reads cached certificates from disk into memory. This allows GetCertificate to serve them without lazy-loading.
func (*Manager) SetOnObtain ¶
SetOnObtain registers a callback invoked after a certificate is successfully obtained or renewed. The callback receives the list of domains.