ssl

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: Apache-2.0, BSD-3-Clause, MIT Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDNSProvider

func CreateDNSProvider(providerID string, credentials map[string]string) (challenge.Provider, error)

CreateDNSProvider creates a lego DNS provider from credentials Per AI.md: Credentials are encrypted JSON stored in config

func DecryptCredentials

func DecryptCredentials(encrypted string, password string) (map[string]string, error)

DecryptCredentials decrypts credentials from encrypted storage

func EncryptCredentials

func EncryptCredentials(credentials map[string]string, password string) (string, error)

EncryptCredentials encrypts credentials JSON using AES-256-GCM Per AI.md: credentials are encrypted with AES-256-GCM before storage

func GetAllDomains

func GetAllDomains() []string

GetAllDomains returns all domains from DOMAIN env var Used for CORS configuration and SSL certificates

func GetDisplayURL

func GetDisplayURL(projectName string, port int, isHTTPS bool) string

GetDisplayURL returns the best URL for display/access Prefers valid FQDN, falls back to global IP if dev TLD

func GetFQDN

func GetFQDN(projectName string) string

GetFQDN resolves the Fully Qualified Domain Name Per AI.md PART 21: use this when no request context available (startup, background tasks) Returns first domain from DOMAIN env var (comma-separated list supported)

func GetHostFromRequest

func GetHostFromRequest(r *http.Request, projectName string) string

GetHostFromRequest resolves the host from an HTTP request Per AI.md PART 21: use this for request-time host resolution (preferred)

func GetWildcardDomain

func GetWildcardDomain() string

GetWildcardDomain infers wildcard from DOMAIN list or learned patterns Returns "*.example.com" if multiple subdomains share same base, else ""

func IsDevTLD

func IsDevTLD(host, projectName string) bool

IsDevTLD checks if the host is a development TLD Per AI.md PART 21: Dev TLD Handling (NON-NEGOTIABLE)

func StartHTTPSRedirect

func StartHTTPSRedirect(addr string, httpsPort int) *http.Server

StartHTTPSRedirect starts an HTTP server that redirects to HTTPS

func ValidatedAtNow

func ValidatedAtNow() string

ValidatedAtNow returns the current timestamp for validated_at field

Types

type CertInfo

type CertInfo struct {
	Subject    string
	Issuer     string
	NotBefore  time.Time
	NotAfter   time.Time
	DNSNames   []string
	IsExpiring bool
}

CertInfo contains certificate information

type DNSProviderInfo

type DNSProviderInfo struct {
	ID          string  `json:"id"`
	Name        string  `json:"name"`
	Fields      []Field `json:"fields"`
	Description string  `json:"description"`
}

DNSProviderInfo contains metadata about a DNS provider Per AI.md PART 17: Admin WebUI provides dropdown with required fields

func DNSProviders

func DNSProviders() []DNSProviderInfo

DNSProviders returns all supported DNS providers with their required fields Per AI.md: Full provider list from lego DNS providers

func GetProviderByID

func GetProviderByID(id string) *DNSProviderInfo

GetProviderByID returns provider info by ID

type Field

type Field struct {
	Name        string `json:"name"`
	Label       string `json:"label"`
	Type        string `json:"type"` // text, password
	Required    bool   `json:"required"`
	Placeholder string `json:"placeholder"`
	Help        string `json:"help"`
}

Field represents a credential field for a DNS provider

type Manager

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

Manager handles TLS certificate management

func NewManager

func NewManager(cfg *config.SSLConfig, dataDir string) *Manager

NewManager creates a new TLS manager

func NewManagerWithSecret

func NewManagerWithSecret(cfg *config.SSLConfig, dataDir, secretKey string) *Manager

NewManagerWithSecret creates a new TLS manager with a secret key for DNS-01 credential decryption

func (*Manager) GetCertInfo

func (m *Manager) GetCertInfo() (*CertInfo, error)

GetCertInfo returns information about the current certificate

func (*Manager) GetHTTPSHandler

func (m *Manager) GetHTTPSHandler(fallback http.Handler) http.Handler

GetHTTPSHandler returns an HTTP handler for ACME challenges This should be used for port 80 to handle Let's Encrypt HTTP-01 challenges

func (*Manager) GetTLSConfig

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

GetTLSConfig returns the TLS configuration

func (*Manager) IsEnabled

func (m *Manager) IsEnabled() bool

IsEnabled returns whether TLS is enabled

func (*Manager) ReloadCertificates

func (m *Manager) ReloadCertificates() error

ReloadCertificates reloads manual certificates

func (*Manager) RenewCertificateDNS01

func (m *Manager) RenewCertificateDNS01(ctx context.Context) error

RenewCertificateDNS01 renews the certificate using DNS-01 challenge Called by scheduler for ssl_renewal task

Jump to

Keyboard shortcuts

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