daemon

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: May 30, 2026 License: MIT Imports: 30 Imported by: 0

Documentation

Overview

Package daemon holds the full sandboxd boot sequence as a single reusable entrypoint, Run. The open-source cmd/sandboxd calls Run with a no-op control plane (controlplane.Noop()); a managed build calls the same Run with a provider backed by the private fleet client. Keeping boot in one exported function is what lets the managed binary reuse the entire daemon without forking main().

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, logger *slog.Logger, makeProvider ProviderFactory) error

Run loads configuration and executes the full daemon boot sequence, blocking until ctx is cancelled (SIGINT/SIGTERM in the standard wrapper), then performs graceful shutdown. Fatal boot failures call os.Exit(1) exactly as the historical main() did; the returned error covers the pre-boot phases (config load, provider construction) and is nil at graceful shutdown.

makeProvider supplies the control-plane capabilities. nil (the open-source default) means controlplane.Noop(): every non-PAT token rejected, every usage report a no-op, every create admitted, no enforcement loop.

Types

type FleetConfig

type FleetConfig struct {
	Enabled         bool
	Endpoint        string
	Token           string
	ContractRefresh time.Duration
}

FleetConfig is the subset of daemon configuration a control-plane provider needs, projected out of the internal config so a managed build can construct its provider without importing internal/config (which Go forbids across modules). It mirrors the SB_FLEET_* settings.

type ProviderFactory

type ProviderFactory func(ctx context.Context, fc FleetConfig) (controlplane.Provider, error)

ProviderFactory builds the control-plane provider from the resolved fleet config. The managed build supplies one (wiring the private avmctl client); the open-source build passes nil, which yields controlplane.Noop(). It receives ctx so a provider can start background work (e.g. contract refresh) bound to the daemon lifecycle.

Jump to

Keyboard shortcuts

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