runtime

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package runtime starts and stops the reference server's HTTP listeners and background workers.

Design

Serve validates listener security, builds the configured application and runs it until cancellation or a serving failure. It supports configured certificate files and managed HTTPS identities. The unified reference server uses a local declaration engine. Plain HTTP is restricted to literal loopback addresses.

ServeListener uses the same lifecycle with a caller-bound listener, retaining an ephemeral port throughout application setup. It owns closing the listener, including on startup failure, and validates the actual bound address.

Shutdown stops HTTP admission and drains active requests before cancelling workers. A shared deadline bounds that drain, and workers that fail to stop are reported as an error. Serve closes the application resources it owns.

References

Index

Constants

This section is empty.

Variables

View Source
var ErrProbe = errors.New("health probe failed")

ErrProbe identifies invalid probe configuration or an unhealthy endpoint.

Functions

func Probe

func Probe(ctx context.Context, cfg ProbeConfig) error

Probe checks storage health with a two-second deadline, without redirects. Automatic probes do not use HTTP proxies. Certificate changes require the serving process to restart before its local certificate pin matches again.

func Serve

func Serve(ctx context.Context, cfg app.Config) error

Serve builds and runs the configured reference application with its HTTP listeners and workers. Cancellation or component failure drains HTTP and workers before closing resources. A drain timeout retains shared resources and maintenance registration.

func ServeListener added in v0.9.2

func ServeListener(ctx context.Context, cfg app.Config, listener net.Listener) error

ServeListener serves an already-bound listener and closes it on every exit path. Embedded callers can retain an ephemeral port throughout application setup. Security checks use the listener's actual address rather than cfg.Listen.

Types

type ProbeConfig

type ProbeConfig struct {
	Certificate *x509.Certificate
	URL         string
	Listen      string
	TLSCertFile string
	TLSKeyFile  string
	CAFile      string
}

ProbeConfig selects an explicit URL or the process configuration with URL=auto. Automatic TLS checks trust and pin the configured certificate, independently of public DNS or the device-identity CA. CAFile is for explicit URL probes.

Jump to

Keyboard shortcuts

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