Documentation
¶
Index ¶
- type Backend
- type CertLoader
- type CertManager
- func (cm *CertManager) CertificateCount() int
- func (cm *CertManager) GetCertificate(hello *tls.ClientHelloInfo) (*tls.Certificate, error)
- func (cm *CertManager) HasCertificate(domain string) bool
- func (cm *CertManager) ReloadCertificates() error
- func (cm *CertManager) SetDomainResolver(resolver DomainResolver)
- func (cm *CertManager) Stop()
- type Config
- type DeploymentInfo
- type DomainResolver
- type HaloydDeployment
- type HaloydDomain
- type HaloydInstance
- type InstanceInfo
- type Proxy
- type Route
- type RouteBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CertLoader ¶
type CertLoader interface {
GetCertificate(hello *tls.ClientHelloInfo) (*tls.Certificate, error)
}
CertLoader is an interface for loading TLS certificates.
type CertManager ¶
type CertManager struct {
// contains filtered or unexported fields
}
CertManager manages TLS certificates for the proxy. It loads certificates from disk and reloads when explicitly told to via ReloadCertificates().
func NewCertManager ¶
func NewCertManager(certDir string, logger *slog.Logger) (*CertManager, error)
NewCertManager creates a new certificate manager.
func (*CertManager) CertificateCount ¶
func (cm *CertManager) CertificateCount() int
CertificateCount returns the number of loaded certificates.
func (*CertManager) GetCertificate ¶
func (cm *CertManager) GetCertificate(hello *tls.ClientHelloInfo) (*tls.Certificate, error)
GetCertificate implements the tls.Config.GetCertificate callback. It returns the certificate for the given SNI hostname.
func (*CertManager) HasCertificate ¶
func (cm *CertManager) HasCertificate(domain string) bool
HasCertificate checks if a certificate exists for the given domain.
func (*CertManager) ReloadCertificates ¶
func (cm *CertManager) ReloadCertificates() error
ReloadCertificates reloads all certificates from disk.
func (*CertManager) SetDomainResolver ¶
func (cm *CertManager) SetDomainResolver(resolver DomainResolver)
SetDomainResolver sets the resolver used for alias lookups.
func (*CertManager) Stop ¶
func (cm *CertManager) Stop()
Stop stops the certificate manager (no-op, retained for interface compatibility).
type Config ¶
type Config struct {
// Routes maps canonical domains (lowercase) to their route configurations.
Routes map[string]*Route
// APIDomain is the domain for the haloy API (lowercase).
APIDomain string
}
Config holds the proxy configuration.
func BuildConfigFromDeployments ¶
func BuildConfigFromDeployments(deployments []DeploymentInfo, apiDomain string) (*Config, error)
BuildConfigFromDeployments creates a proxy config from deployment information.
func BuildConfigFromHaloydDeployments ¶
func BuildConfigFromHaloydDeployments(deployments map[string]HaloydDeployment, apiDomain string) (*Config, error)
BuildConfigFromHaloydDeployments converts the haloyd deployment format to proxy config.
type DeploymentInfo ¶
type DeploymentInfo struct {
AppName string
Canonical string
Aliases []string
Instances []InstanceInfo
}
BuildRoutesFromDeployments is a helper function to build routes from a deployment map. This function bridges the gap between the deployment manager's data structure and the proxy's route configuration.
type DomainResolver ¶
DomainResolver resolves alias domains to canonical domains.
type HaloydDeployment ¶
type HaloydDeployment struct {
AppName string
Domains []HaloydDomain
Instances []HaloydInstance
}
ConvertDeployments is a convenience type alias for the deployment map format used by haloyd's DeploymentManager.
type HaloydDomain ¶
type HaloydInstance ¶
type InstanceInfo ¶
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
Proxy is an HTTP reverse proxy with TLS termination and host-based routing.
func (*Proxy) ResolveCanonical ¶
ResolveCanonical resolves an alias domain to its canonical domain.
func (*Proxy) UpdateConfig ¶
UpdateConfig atomically updates the proxy configuration.
type RouteBuilder ¶
type RouteBuilder struct {
// contains filtered or unexported fields
}
RouteBuilder helps build proxy routes from deployment information.
func NewRouteBuilder ¶
func NewRouteBuilder() *RouteBuilder
NewRouteBuilder creates a new route builder.
func (*RouteBuilder) AddRoute ¶
func (rb *RouteBuilder) AddRoute(canonical string, aliases []string, backends []Backend)
AddRoute adds a route for an application.
func (*RouteBuilder) Build ¶
func (rb *RouteBuilder) Build() (*Config, error)
Build creates the final proxy configuration. Returns an error if duplicate aliases are detected across routes.
func (*RouteBuilder) SetAPIDomain ¶
func (rb *RouteBuilder) SetAPIDomain(domain string)
SetAPIDomain sets the API domain for the configuration.