autotls

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ServeTLS

func ServeTLS(ctx context.Context, log *slog.Logger, dataPath string, email string, routeWatcher RouteWatcher, h http.Handler) error

func ServeTLSSelfSigned added in v0.3.0

func ServeTLSSelfSigned(ctx context.Context, log *slog.Logger, h http.Handler) error

ServeTLSSelfSigned serves HTTPS using a self-signed certificate. This is intended for development and testing only.

func ServeTLSWithController

func ServeTLSWithController(ctx context.Context, log *slog.Logger, certProvider CertificateProvider, h http.Handler) error

ServeTLSWithController serves HTTPS using certificates provided by a controller

Types

type CertificateProvider

type CertificateProvider interface {
	GetCertificate(hello *tls.ClientHelloInfo) (*tls.Certificate, error)
}

CertificateProvider provides certificates via GetCertificate callback

type RouteSet added in v0.3.0

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

RouteSet is a thread-safe set of hosts with configured routes. It implements RouteWatcher and can be updated as routes change.

func NewRouteSet added in v0.3.0

func NewRouteSet() *RouteSet

NewRouteSet creates a new empty RouteSet.

func (*RouteSet) Add added in v0.3.0

func (rs *RouteSet) Add(host string)

Add adds a host to the route set.

func (*RouteSet) HasRoute added in v0.3.0

func (rs *RouteSet) HasRoute(host string) bool

HasRoute returns true if the host has a configured route.

func (*RouteSet) Remove added in v0.3.0

func (rs *RouteSet) Remove(host string)

Remove removes a host from the route set.

func (*RouteSet) Replace added in v0.3.0

func (rs *RouteSet) Replace(hosts []string)

Replace replaces all hosts in the set with the provided list.

type RouteWatcher added in v0.3.0

type RouteWatcher interface {
	// HasRoute returns true if a route exists for the given host.
	// This should be a fast in-memory lookup.
	HasRoute(host string) bool
}

RouteWatcher provides access to the set of hosts with configured routes. Implementations should watch for route changes and keep the set current.

Jump to

Keyboard shortcuts

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