edgetls

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package edgetls is the TLS termination provider port (ADR-0111, F74): it builds the *tls.Config funcd attaches to its own http.Servers (no listener handover — the caller drives ServeTLS). Three modes select a driver: `selfsigned` + `provided` are pure stdlib (internal/edge/tls/static); `acme` is certmagic (internal/edge/tls/acme) — the only mode that pulls the ACME dependency. The drivers satisfy Provider structurally (they do not import this package), so there is no cycle.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mode

type Mode string

Mode selects the certificate issuance strategy.

const (
	// ModeSelfSigned generates + persists one multi-SAN self-signed cert (stdlib). The default when
	// TLS is enabled: offline, zero-config (homebox/LAN). Browser-untrusted by design.
	ModeSelfSigned Mode = "selfsigned"
	// ModeProvided serves an operator-supplied cert + key (stdlib).
	ModeProvided Mode = "provided"
	// ModeACME obtains automatic public certificates via certmagic/ACME.
	ModeACME Mode = "acme"
)

type Provider

type Provider interface {
	// TLSConfig returns the config to attach to an http.Server (GetCertificate-driven). static sets
	// NextProtos=[h2,http/1.1]; acme returns certmagic's config unmodified (keeps acme-tls/1).
	TLSConfig() (*tls.Config, error)
	// Manage ensures/authorizes certs for the host set (Router.Hosts() + Spec.Hosts).
	Manage(ctx context.Context, hosts []string) error
	// Close halts background work (acme renewal goroutine); no-op for static. Wired into shutdown.
	Close(ctx context.Context) error
}

Provider builds the *tls.Config funcd attaches to its http.Servers (no listener handover).

func New

func New(spec Spec, logger *slog.Logger) (Provider, error)

New builds the provider for a Spec, selecting the driver by Mode. An empty Mode defaults to selfsigned (the enabled-TLS default).

type Spec

type Spec struct {
	Mode       Mode
	Hosts      []string // configured hosts, merged with the F79 Router.Hosts() at Manage time
	CertFile   string   // provided: PEM cert (chain)
	KeyFile    string   // provided: PEM key
	Email      string   // acme: ACME account email
	CADir      string   // acme: ACME directory URL (empty ⇒ Let's Encrypt; a Pebble URL in tests)
	StorageDir string   // persistence dir (self-signed cert / acme accounts+certs)
}

Spec configures the provider.

Directories

Path Synopsis
Package acme is the certmagic-backed ACME TLS driver (ADR-0111, F74): automatic public certificates via an ACME CA (Let's Encrypt by default; a test directory URL for Pebble).
Package acme is the certmagic-backed ACME TLS driver (ADR-0111, F74): automatic public certificates via an ACME CA (Let's Encrypt by default; a test directory URL for Pebble).
Package static is the stdlib TLS driver (ADR-0111, F74): it builds a *tls.Config from a static certificate — either operator-PROVIDED (tls.LoadX509KeyPair) or SELF-SIGNED (one multi-SAN cert this package generates with crypto/x509 and persists under the storage dir).
Package static is the stdlib TLS driver (ADR-0111, F74): it builds a *tls.Config from a static certificate — either operator-PROVIDED (tls.LoadX509KeyPair) or SELF-SIGNED (one multi-SAN cert this package generates with crypto/x509 and persists under the storage dir).

Jump to

Keyboard shortcuts

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