Documentation
¶
Overview ¶
pkg/core/server.go
Index ¶
- func Flush(w http.ResponseWriter) error
- func RunServer(srv *Server, ctx context.Context)
- type Option
- type Server
- func (s *Server) AddRoute(port int, pattern string, h http.Handler)
- func (s *Server) Cfg() config.Config
- func (s *Server) Metrics() *metrics.Metrics
- func (s *Server) RegisterListener(name string) (onBound func())
- func (s *Server) Reload() error
- func (s *Server) ReloadHandler() http.Handler
- func (s *Server) Run(ctx context.Context)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Flush ¶ added in v0.9.8
func Flush(w http.ResponseWriter) error
Flush pushes any buffered response bytes to the client immediately. It is keel's streaming-passthrough surface: a handler relaying an upstream stream (SSE or chunked) calls Flush after writing each event so the client receives it live rather than at end-of-response.
keel's middleware chain wraps the http.ResponseWriter (metrics, access log, OWASP body limit, OTel span), and those wrappers are not themselves http.Flushers — so a handler MUST NOT depend on a direct w.(http.Flusher) assertion. Flush goes through http.ResponseController, which traverses each wrapper's Unwrap to reach the connection's flusher. It returns an error only when the underlying transport genuinely cannot flush (e.g. a writer with no flusher in its chain).
Types ¶
type Option ¶
type Option func(*Server)
func WithConfig ¶
func WithConfigPaths ¶
WithConfigPaths records the config and secrets file paths used by Reload. configPath and secretsPath may be empty strings if unused.
func WithDefaultRegistrar ¶
func WithDefaultRegistrar() Option
func WithLogger ¶
func WithReadinessCheck ¶
WithReadinessCheck registers a named dependency check evaluated on /readyz. fn should return a non-nil error when the dependency is unhealthy.
func WithRegistrar ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) AddRoute ¶
AddRoute registers a handler on the given port and URL pattern. Must be called before Run.
func (*Server) Metrics ¶ added in v0.9.8
Metrics returns the server's metrics store so an embedder can register custom Collectors whose series render on the built-in /metrics endpoint alongside keel's own, through the same responder. Register before Run.
func (*Server) RegisterListener ¶ added in v0.9.10
RegisterListener enrolls an embedder-owned listener in the /readyz barrier. The caller binds and serves its own socket and must call the returned onBound once it is bound; until then /readyz is not-ready and lists "listener:<name>". Must be called before Run.
func (*Server) Reload ¶
Reload re-reads the configuration from the paths supplied via WithConfigPaths, validates it, and—if valid—applies live fields (stored config, TLS certificate). On any error the running configuration is left unchanged.
func (*Server) ReloadHandler ¶
ReloadHandler returns an http.Handler for POST /admin/reload. A successful reload responds 200; an invalid config responds 422.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package fips provides runtime FIPS posture verification.
|
Package fips provides runtime FIPS posture verification. |
|
Package logging provides the structured logger used throughout keel.
|
Package logging provides the structured logger used throughout keel. |
|
pkg/core/ports/ports.go
|
pkg/core/ports/ports.go |
|
pkg/core/probes/mux.go
|
pkg/core/probes/mux.go |
|
pkg/core/router/router.go
|
pkg/core/router/router.go |
|
Package tracing implements a lightweight OTLP/HTTP span exporter using only the standard library.
|
Package tracing implements a lightweight OTLP/HTTP span exporter using only the standard library. |