Documentation
¶
Index ¶
- Variables
- func GetControllerConfig(ctx context.Context, getter ControllerConfigGetter) (controller.Config, error)
- func Manifold(config ManifoldConfig) dependency.Manifold
- func NewTLSConfig(certDNSName, certURL string, certCache autocert.Cache, ...) *tls.Config
- func NewWorkerShim(config Config) (worker.Worker, error)
- type Config
- type ControllerConfigGetter
- type ManifoldConfig
- type SNIGetterFunc
- type Worker
Constants ¶
This section is empty.
Variables ¶
var ( // ShutdownTimeout is how long the http server will wait for active connections // to close. ShutdownTimeout = 30 * time.Second )
Functions ¶
func GetControllerConfig ¶
func GetControllerConfig(ctx context.Context, getter ControllerConfigGetter) (controller.Config, error)
GetControllerConfig gets the controller config from a *State - it exists so we can test the manifold without a StateSuite.
func Manifold ¶
func Manifold(config ManifoldConfig) dependency.Manifold
Manifold returns a dependency.Manifold that will run an HTTP server worker. The manifold outputs an *apiserverhttp.Mux, for other workers to register handlers against.
func NewTLSConfig ¶
func NewTLSConfig(certDNSName, certURL string, certCache autocert.Cache, defaultSNI SNIGetterFunc, logger logger.Logger) *tls.Config
NewTLSConfig returns the TLS configuration for the HTTP server to use based on controller configuration stored in the state database.
Types ¶
type Config ¶
type Config struct {
AgentName string
Clock clock.Clock
TLSConfig *tls.Config
Mux *apiserverhttp.Mux
MuxShutdownWait time.Duration
LogDir string
Logger logger.Logger
PrometheusRegisterer prometheus.Registerer
Hub *pubsub.StructuredHub
APIPort int
APIPortOpenDelay time.Duration
ControllerAPIPort int
}
Config is the configuration required for running an API server worker.
type ControllerConfigGetter ¶
type ControllerConfigGetter interface {
ControllerConfig(context.Context) (controller.Config, error)
}
ControllerConfigGetter is an interface that returns the controller config.
type ManifoldConfig ¶
type ManifoldConfig struct {
AuthorityName string
HubName string
MuxName string
StateName string
DomainServicesName string
// We don't use these in the worker, but we want to prevent the
// httpserver from starting until they're running so that all of
// their handlers are registered.
APIServerName string
AgentName string
Clock clock.Clock
MuxShutdownWait time.Duration
LogDir string
PrometheusRegisterer prometheus.Registerer
Logger logger.Logger
GetControllerConfig func(context.Context, ControllerConfigGetter) (controller.Config, error)
NewTLSConfig func(string, string, autocert.Cache, SNIGetterFunc, logger.Logger) *tls.Config
NewWorker func(Config) (worker.Worker, error)
}
ManifoldConfig holds the information necessary to run an HTTP server in a dependency.Engine.
func (ManifoldConfig) Validate ¶
func (config ManifoldConfig) Validate() error
Validate validates the manifold configuration.
type SNIGetterFunc ¶
type SNIGetterFunc func(*tls.ClientHelloInfo) (*tls.Certificate, error)
SNIGetterFunc is a helper function that aids the TLS SNI process by working out if a certificate can be provided that satisfies the TLS ClientHello message. If no the function has no matches then a error that satisfies NotFound should be returned. Alternatively if the function can not help in the process of finding a certificate a error that satisfies NotImplemented should be returned.
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
func (*Worker) URL ¶
URL returns the base URL of the HTTP server of the form https://ipaddr:port with no trailing slash.