cli

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 95 Imported by: 0

Documentation

Overview

Package cli implements the cobra command tree and BusyBox dispatch logic. When invoked as "cheesewaf", the default command is "serve" (starts WAF). When invoked as "waf-cli", the default command is the interactive TUI panel.

Index

Constants

View Source
const (
	EnvProductionCRPListenEndpoint        = "CHEESEWAF_CRP_LISTEN_ENDPOINT"
	EnvProductionCRPSidecarListenEndpoint = "CHEESEWAF_CRP_SIDECAR_LISTEN_ENDPOINT"
	EnvProductionCRPControlEndpoint       = "CHEESEWAF_CRP_CONTROL_ENDPOINT"
	EnvProductionCRPSidecarEndpoint       = "CHEESEWAF_CRP_SIDECAR_ENDPOINT"
	EnvProductionCRPSidecarRegistryFile   = "CHEESEWAF_CRP_SIDECAR_REGISTRY_FILE"
	EnvProductionCRPCAFile                = "CHEESEWAF_CRP_CA_FILE"
	EnvProductionCRPServerCertFile        = "CHEESEWAF_CRP_SERVER_CERT_FILE"
	EnvProductionCRPServerKeyFile         = "CHEESEWAF_CRP_SERVER_KEY_FILE"
	EnvProductionCRPClientCertFile        = "CHEESEWAF_CRP_CLIENT_CERT_FILE"
	EnvProductionCRPClientKeyFile         = "CHEESEWAF_CRP_CLIENT_KEY_FILE"
	EnvProductionCRPControlServerName     = "CHEESEWAF_CRP_CONTROL_SERVER_NAME"
	EnvProductionCRPSidecarServerName     = "CHEESEWAF_CRP_SIDECAR_SERVER_NAME"
)

Variables

View Source
var (
	ErrProductionCRPUnavailable = errors.New("production CRP composition is unavailable")
	ErrProductionCRPConfig      = errors.New("production CRP runtime configuration is invalid")
	ErrProductionCRPLifecycle   = errors.New("production CRP lifecycle is invalid")
)
View Source
var (
	ErrProductionCWEDPUnavailable = errors.New("production CWEDP composition is unavailable")
	ErrProductionCWEDPConfig      = errors.New("production CWEDP runtime configuration is invalid")
)
View Source
var (
	ErrMaterializerHandlerRequired    = errors.New("protection materializer handler is required")
	ErrMaterializerRuntimeRequired    = errors.New("protection materializer runtime callback is required")
	ErrMaterializerRuntimeDirRequired = errors.New("protection materializer runtime directory is required")
)
View Source
var (
	// ErrProductionServeWiringUnavailable means the adapters passed their
	// health probes but the request-serving layer did not explicitly bind them.
	// A healthy backend is not sufficient evidence that cheesewaf serve can
	// safely consume it.
	ErrProductionServeWiringUnavailable      = errors.New("production serve wiring is unavailable")
	ErrProductionRedisUnavailable            = errors.New("production Redis dependency is unavailable")
	ErrProductionApprovalUnavailable         = errors.New("production approval dependency is unavailable")
	ErrProductionApprovalHTTPUnavailable     = errors.New("production approval HTTP handler is unavailable")
	ErrProductionApprovalEpochUnavailable    = errors.New("production approval policy epoch is unavailable")
	ErrProductionApprovalEpochMismatch       = errors.New("production approval policy epoch does not match control-plane epoch")
	ErrProductionServeWiringConflict         = errors.New("production serve wiring callbacks are mutually exclusive")
	ErrProductionTemporaryNetworkUnavailable = errors.New("production temporary network provider is unavailable")
	ErrProductionTemporaryNetworkSession     = errors.New("production temporary network management session is invalid")
	ErrProductionTemporaryNetworkAudit       = errors.New("production temporary network audit sink is unavailable")
	ErrProductionTemporaryNetworkAdapter     = errors.New("production temporary network adapter is not lease-bound")
)

Functions

func ConfigurePaths

func ConfigurePaths(configFile, dataDirectory string)

ConfigurePaths sets the package-level config/data paths used by status/stop helpers. Desktop controllers must call this before InspectServiceStatus.

func Execute

func Execute(execName string)

Execute dispatches the root command based on the executable name (BusyBox pattern). If called as "waf-cli", it defaults to the interactive TUI panel. If called as "cheesewaf" (or anything else), it defaults to starting the WAF server.

func NewProductionCWEDPConsumer added in v0.4.0

func NewProductionCWEDPConsumer(provider ProductionTemporaryNetworkProvider, opts ProductionCWEDPConsumerOptions) (consumer.Executor, error)

NewProductionCWEDPConsumer joins the request-scoped temporary-network provider to the generic CWEDP consumer. Each external Puller attempt calls CWEDPAdapter anew; no provider-owned lease, session, socket, or HTTP client is retained by the consumer.

func NewProtectionPolicyMaterializer added in v0.4.0

func NewProtectionPolicyMaterializer(h *handler.Handler, validator materializer.CurrentCommitValidator, runtimeDir string) (*materializer.ProtectionPolicyApplier, error)

NewProtectionPolicyMaterializer assembles the node-local materializer from the same Handler that serves the management API. It owns only the local snapshot, YAML and protection-runtime seams; proposal creation and coordinator ownership stay outside this constructor.

The Handler must already carry a real OnProtectionChanged callback. A handler without that callback can persist YAML but cannot prove that the data-plane runtime was updated, so construction fails closed.

Types

type ProductionApprovalDependency

type ProductionApprovalDependency interface {
	ProductionHealthDependency
	ApprovalHTTP() *handler.ApprovalHTTPHandler
	PolicyEpoch() uint64
	ApprovalClaimResolver() activation.ApprovalClaimResolver
}

ProductionApprovalDependency is the complete production approval boundary. The handler and policy epoch are part of the contract so a healthy but incomplete approval fake cannot reach the request-serving layer.

type ProductionCRP added in v0.4.0

type ProductionCRP struct {
	// contains filtered or unexported fields
}

ProductionCRP owns the production CRP handler, outbound mTLS adapters, activation service and authorization listener. Runtime and fence source lifetimes remain owned by the caller so the same durable runtime can be shared with CWEDP without opening a second store.

func OpenProductionCRP added in v0.4.0

func OpenProductionCRP(ctx context.Context, opts ProductionCRPOptions) (*ProductionCRP, error)

OpenProductionCRP constructs the complete production bundle without starting its listener. Call Start after the owning serve lifecycle is ready. Every authority-bearing dependency and every TLS endpoint must be supplied explicitly; no CA, certificate, fence, provider, sidecar or runtime is synthesized here.

func (*ProductionCRP) Close added in v0.4.0

func (p *ProductionCRP) Close() error

Close immediately terminates the listener and then releases service-owned workers and sidecars. It is idempotent and safe after Shutdown.

func (*ProductionCRP) ControlPlane added in v0.4.0

func (p *ProductionCRP) ControlPlane() *activation.HTTPControlPlaneClient

func (*ProductionCRP) Endpoint added in v0.4.0

func (p *ProductionCRP) Endpoint() string

func (*ProductionCRP) Handler added in v0.4.0

func (*ProductionCRP) Runtime added in v0.4.0

func (p *ProductionCRP) Runtime() *crp.RuntimeStore

Runtime returns the caller-owned runtime instance used by Service. It is exposed so the main serve composition can prove it is sharing the exact CWEDP runtime rather than opening a second state directory.

func (*ProductionCRP) Service added in v0.4.0

func (p *ProductionCRP) Service() *activation.Service

func (*ProductionCRP) Shutdown added in v0.4.0

func (p *ProductionCRP) Shutdown(ctx context.Context) error

Shutdown gracefully stops admission, then closes the activation worker and all sidecars it owns. It does not close the shared RuntimeStore or fence source, whose lifetime belongs to the main production dependency graph.

func (*ProductionCRP) SidecarEndpoint added in v0.4.0

func (p *ProductionCRP) SidecarEndpoint() string

func (*ProductionCRP) SidecarHandler added in v0.4.0

func (p *ProductionCRP) SidecarHandler() *activation.SidecarLauncherHandler

func (*ProductionCRP) Sidecars added in v0.4.0

func (*ProductionCRP) Start added in v0.4.0

func (p *ProductionCRP) Start() error

Start begins serving TLS 1.3 with mandatory verified client certificates. The listener is opened during construction so bind failures happen before the owning process reports readiness.

func (*ProductionCRP) Wait added in v0.4.0

func (p *ProductionCRP) Wait(ctx context.Context) error

Wait blocks until the listener exits or the supplied context is canceled.

type ProductionCRPActivationExecutor added in v0.4.0

type ProductionCRPActivationExecutor struct {
	// contains filtered or unexported fields
}

ProductionCRPActivationExecutor adapts the process-owned activation service to the management API. Authority remains owned by the service: the adapter neither accepts nor synthesizes approval claims, confirmations, fences, or any other authorization material.

func NewProductionCRPActivationExecutor added in v0.4.0

func NewProductionCRPActivationExecutor(service *activation.Service) (*ProductionCRPActivationExecutor, error)

NewProductionCRPActivationExecutor binds an already-configured production activation service to the management API executor seam.

func (*ProductionCRPActivationExecutor) ExecuteCRPActivation added in v0.4.0

ExecuteCRPActivation submits the authority-free request to the bounded activation worker and waits for its final receipt. Submission failures and worker results are returned unchanged so the HTTP layer can map stable cancellation, queue, authorization, and runtime errors.

type ProductionCRPCompositionOptions added in v0.4.0

type ProductionCRPCompositionOptions struct {
	CRP                   ProductionCRPOptions
	AuthorizationDSN      string
	Consensus             ProductionConsensusDependency
	Runtime               *crp.RuntimeStore
	ApprovalClaimResolver activation.ApprovalClaimResolver
	ActivationPolicy      activation.Policy
}

ProductionCRPCompositionOptions joins the already-bootstrapped consensus, durable approval runtime and exact CWEDP RuntimeStore with runtime-only mTLS transport configuration. None of these values are serialized into the tracked YAML template.

type ProductionCRPDependency added in v0.4.0

type ProductionCRPDependency interface {
	Start() error
	Wait(context.Context) error
	Shutdown(context.Context) error
	Close() error
	Runtime() *crp.RuntimeStore
	ActivationExecutor() handler.CRPActivationExecutor
}

ProductionCRPDependency is the process-owned CRP lifecycle exposed to the main serve loop. The management API receives only ActivationExecutor; it cannot reach the authorization store, fence source or mTLS transports.

type ProductionCRPFenceSource added in v0.4.0

type ProductionCRPFenceSource struct {
	// contains filtered or unexported fields
}

ProductionCRPFenceSource projects the exact live native-raft fence into the CRP activation contract. The token is a deterministic digest of every native-raft fencing field, rather than a locally minted capability.

CurrentFence requires the local consensus dependency to establish the current fence. A follower, unavailable raft runtime, or inconsistent snapshot therefore fails closed instead of issuing a CRP authorization.

func NewProductionCRPFenceSource added in v0.4.0

func NewProductionCRPFenceSource(consensus ProductionConsensusDependency) (*ProductionCRPFenceSource, error)

func (*ProductionCRPFenceSource) CurrentFence added in v0.4.0

func (*ProductionCRPFenceSource) ValidateFence added in v0.4.0

func (s *ProductionCRPFenceSource) ValidateFence(ctx context.Context, authorization activation.Authorization, observed activation.Fence) error

ValidateFence deliberately obtains a second current fence. CurrentFence is called immediately before this method by the durable store, while this second read detects a leader, epoch, revision, digest, or nonce transition that races that first read. The caller must not retain a PostgreSQL transaction or row lock while calling this method.

type ProductionCRPOptions added in v0.4.0

type ProductionCRPOptions struct {
	ListenEndpoint        string
	SidecarListenEndpoint string
	ControlEndpoint       string
	SidecarEndpoint       string
	CAFile                string
	ServerCertFile        string
	ServerKeyFile         string
	ClientCertFile        string
	ClientKeyFile         string
	ControlServerName     string
	SidecarServerName     string
	SidecarRegistryFile   string

	ClusterID        string
	NodeID           string
	TransportTimeout time.Duration

	Runtime               *crp.RuntimeStore
	State                 activation.AuthorizationState
	Provider              activation.AuthorizationProvider
	Audit                 activation.DurableAuthorizationAudit
	FenceSource           activationpostgres.FenceSource
	SidecarBackend        activation.SidecarLauncherBackend
	SidecarMaxSlots       int
	ApprovalClaimResolver activation.ApprovalClaimResolver
	Policy                activation.Policy
	Clock                 func() time.Time
	AsyncQueueSize        int
	AsyncWorkers          int
	OperationTimeout      time.Duration
}

ProductionCRPOptions is runtime-only process configuration. The paths and endpoints are intentionally not derived from the tracked YAML template. Runtime, Provider, State, Audit and FenceSource are opened by the owning production launcher and are never replaced with process-local fallbacks.

func ProductionCRPOptionsFromEnvironment added in v0.4.0

func ProductionCRPOptionsFromEnvironment(opts ProductionCRPOptions) ProductionCRPOptions

ProductionCRPOptionsFromEnvironment fills only unset transport fields from the process environment. Explicit launcher options always win. Values are preserved byte-for-byte so leading/trailing or invisible whitespace is rejected later rather than silently normalized into another identity.

type ProductionCWEDPAdmission added in v0.4.0

type ProductionCWEDPAdmission struct {
	Registry       transport.Registry
	IntentVerifier cwedp.IntentSignatureVerifier
	ImportOptions  crp.ImportOptions
}

type ProductionCWEDPConsumerOptions added in v0.4.0

type ProductionCWEDPConsumerOptions struct {
	ResumeStore           *cwedppostgres.ResumeStore
	Registry              transport.Registry
	IntentVerifier        cwedp.IntentSignatureVerifier
	CRPImportOptions      crp.ImportOptions
	Runtime               *crp.RuntimeStore
	PolicyEpoch           uint64
	MinIndependentSources int
}

ProductionCWEDPConsumerOptions deliberately contains runtime-owned trust objects rather than YAML fields. A deployment launcher must supply a signed intent verifier, immutable endpoint registry, CRP trust/admission context, PostgreSQL resume store and staging runtime as one reviewed composition.

type ProductionCWEDPDownloadCloser added in v0.4.0

type ProductionCWEDPDownloadCloser interface {
	consumer.Executor
	Close() error
}

ProductionCWEDPDownloadCloser is the optional lifecycle contract for an explicitly injected CWEDP consumer. The factory keeps returning the consumer.Executor compatibility interface, while composition roots that open durable resources (for example a PostgreSQL ResumeStore) can return a consumer that releases those resources here.

type ProductionCWEDPLeaseRequest added in v0.4.0

type ProductionCWEDPLeaseRequest struct {
	Identity       netlease.AdministratorIdentity
	Password       string
	PluginID       string
	PluginVersion  string
	Target         netlease.Target
	TLSFingerprint string
	PolicyEpoch    uint64
	TTL            time.Duration
	MaxBytes       int64
}

ProductionCWEDPLeaseRequest is the request-scoped capability needed to obtain one CWEDP HTTP adapter. The caller supplies the authenticated management identity and fresh password confirmation; no identity, session, lease, or adapter is retained in production startup state.

type ProductionCWEDPOptions added in v0.4.0

type ProductionCWEDPOptions struct {
	ResumeDSN             string
	RegistryPath          string
	TrustRootsPath        string
	SourcesPath           string
	IntentKeysPath        string
	RuntimeDir            string
	MinIndependentSources int
}

ProductionCWEDPOptions names runtime-owned admission and state snapshots. These files are deliberately outside the tracked source config. A missing file, empty registry, or invalid key is a hard startup failure.

type ProductionConsensusDependency

type ProductionConsensusDependency interface {
	controlplane.ConsensusBootstrap
	controlplane.FenceBootstrap
	Machine() *controlplane.StateMachine
	Close() error
}

ProductionConsensusDependency combines native-raft consensus and fencing. Machine is required so Bootstrap can install the verified snapshot into the exact state machine owned by the consensus runtime.

type ProductionControlDependency

type ProductionControlDependency interface {
	controlplane.DurableBootstrap
	Close() error
}

ProductionControlDependency is the control-plane PostgreSQL adapter. It is intentionally not storage.Store: control-plane desired-state commits have a different contract from management sites, users, sessions, and reviews.

type ProductionDependencies

type ProductionDependencies struct {
	Management       storage.Store
	Control          ProductionControlDependency
	Consensus        ProductionConsensusDependency
	Redis            ProductionHealthDependency
	Approval         ProductionApprovalDependency
	ApprovalHTTP     *handler.ApprovalHTTPHandler
	TemporaryNetwork *ProductionTemporaryNetworkWiring
	CWEDPDownload    consumer.Executor
	CRP              ProductionCRPDependency
	Startup          controlplane.StartupResult
	CWEDP            ProductionCWEDPOptions
	Serve            ProductionServeWiring
	Ready            bool
	// contains filtered or unexported fields
}

ProductionDependencies owns every resource opened by one production startup attempt. Close is idempotent and always runs in reverse dependency order, including when Bootstrap or final serve wiring fails.

func OpenProductionDependencies

func OpenProductionDependencies(ctx context.Context, opts ProductionStartupOptions, factory ProductionDependencyFactory) (*ProductionDependencies, error)

OpenProductionDependencies executes the complete production startup unit. It never returns a partially initialized dependency set. In particular, a control-plane store is never returned as a management storage.Store.

func (*ProductionDependencies) Close

func (d *ProductionDependencies) Close() error

func (*ProductionDependencies) ServeWiring added in v0.4.0

ServeWiring returns the validated handoff for the request-serving layer. It fails closed if the provider, handler Gate, or control-plane snapshot disagree about the policy epoch.

type ProductionDependencyFactory

type ProductionDependencyFactory struct {
	OpenManagement func(context.Context, config.ManagementPostgreSQLConfig) (storage.Store, error)
	OpenControl    func(context.Context, config.ManagementPostgreSQLConfig) (ProductionControlDependency, error)
	OpenConsensus  func(context.Context, nativeraft.Options) (ProductionConsensusDependency, error)
	OpenRedis      func(context.Context, redis.Config) (ProductionHealthDependency, error)
	OpenApproval   func(context.Context, ProductionStartupOptions) (ProductionApprovalDependency, error)
	// OpenTemporaryNetwork creates the session-bound provider used by the main
	// serve composition root. Callers embedding this factory may replace it,
	// but must preserve the same management-store and policy-epoch binding.
	OpenTemporaryNetwork func(context.Context, ProductionTemporaryNetworkOptions) (*ProductionTemporaryNetworkWiring, error)
	// OpenCWEDPDownload supplies the complete durable CWEDP/CRP consumer. If it
	// is omitted the corresponding management route remains absent; if present,
	// startup rejects a failed or nil consumer rather than exposing a partial
	// download path.
	OpenCWEDPDownload func(context.Context, ProductionServeWiring) (consumer.Executor, error)
	// The following openers are the runtime-owned CWEDP composition seams used
	// by the default download opener. They are separate so deployment launchers
	// can bind durable control-plane adapters without weakening admission.
	OpenCWEDPAdmission   func(context.Context, ProductionCWEDPOptions) (ProductionCWEDPAdmission, error)
	OpenCWEDPResumeStore func(context.Context, ProductionCWEDPOptions) (*cwedppostgres.ResumeStore, error)
	OpenCWEDPRuntime     func(context.Context, ProductionCWEDPOptions, ProductionCWEDPAdmission) (*crp.RuntimeStore, error)
	OpenCRP              func(context.Context, ProductionCRPCompositionOptions) (ProductionCRPDependency, error)
	// WireServe is the legacy production composition hook. Keep it for
	// embedding launchers compiled against the original API.
	WireServe func(context.Context, *ProductionDependencies) error
	// WireServeWithWiring is the preferred hook. It receives a validated,
	// lifecycle-bound handoff and cannot be configured together with WireServe.
	WireServeWithWiring func(context.Context, ProductionServeWiring) error
}

ProductionDependencyFactory opens each production dependency. Every opener is injected so tests and embedding launchers can prove ordering and cleanup without pretending that a fake backend is a production deployment.

func DefaultProductionDependencyFactory

func DefaultProductionDependencyFactory() ProductionDependencyFactory

DefaultProductionDependencyFactory is an explicit alias for launchers that prefer factory terminology over constructor terminology.

func NewProductionDependencyFactory

func NewProductionDependencyFactory() ProductionDependencyFactory

NewProductionDependencyFactory returns the real adapter openers. Callers that need deterministic tests should replace individual callbacks and keep WireServe explicit.

type ProductionHealthDependency

type ProductionHealthDependency interface {
	Health(context.Context) error
	Close() error
}

ProductionHealthDependency is the common boundary for short-lived runtime dependencies such as Redis and the approval service.

type ProductionServeWiring added in v0.4.0

type ProductionServeWiring struct {
	ManagementStore       storage.Store
	Startup               controlplane.StartupResult
	ApprovalHTTP          *handler.ApprovalHTTPHandler
	SessionValidator      middleware.SessionValidator
	PolicyEpoch           uint64
	TemporaryHTTPExecutor netlease.TemporaryHTTPExecutor
	TemporaryNetwork      ProductionTemporaryNetworkProvider
	CWEDPDownload         consumer.Executor
	CRPActivation         handler.CRPActivationExecutor
	CWEDP                 ProductionCWEDPOptions
}

ProductionServeWiring is the validated composition-root handoff consumed by the request-serving layer. It binds the management store, control-plane readiness snapshot, and approval HTTP transport to one policy epoch.

type ProductionStartupOptions

type ProductionStartupOptions struct {
	Profile              string
	ClusterID            string
	ManagementPostgreSQL config.ManagementPostgreSQLConfig
	ControlPostgreSQL    config.ManagementPostgreSQLConfig
	NativeRaft           nativeraft.Options
	Redis                redis.Config
	RedisEnabled         bool
	// ManagementStore and ApprovalEpoch are populated only after the
	// control-plane Bootstrap succeeds. They keep the production approval
	// opener explicitly bound to the same management store and current durable
	// fencing generation; they are not serialized configuration fields.
	ManagementStore storage.Store
	ApprovalEpoch   uint64
	// DataDir is the runtime-owned root for durable temporary-network audit
	// records. It is never read from or written to the tracked config template.
	DataDir string
	// CWEDP carries only runtime-owned paths and the control PostgreSQL DSN
	// needed by the production download composition. It is never serialized in
	// the tracked YAML config; missing admission files fail closed.
	CWEDP ProductionCWEDPOptions
	// CRP contains runtime-only transport endpoints and certificate paths. The
	// composition root fills durable authority, the exact CWEDP runtime, live
	// consensus fence and approval resolver after bootstrap.
	CRP ProductionCRPOptions
}

ProductionStartupOptions is deliberately separate from the serializable Config. It prevents an incomplete production startup contract from being enabled merely by adding a YAML key. A deployment launcher must provide both PostgreSQL roles, explicit native-raft options, and a Redis identity.

type ProductionTemporaryNetworkOptions added in v0.4.0

type ProductionTemporaryNetworkOptions struct {
	ManagementStore storage.Store
	PolicyEpoch     uint64
	DataDir         string
}

ProductionTemporaryNetworkOptions is the narrow input contract for the production temporary-network provider. The provider receives the durable management store and current fence, then obtains identity/session/lease state from each request rather than startup options.

type ProductionTemporaryNetworkProvider added in v0.4.0

type ProductionTemporaryNetworkProvider interface {
	netlease.TemporaryHTTPExecutor
	CWEDPAdapter(context.Context, ProductionCWEDPLeaseRequest) (transport.LeaseBoundAdapter, error)
	Close() error
}

ProductionTemporaryNetworkProvider is the request-level temporary-egress boundary. ExecuteTemporaryHTTP and CWEDPAdapter must independently validate the current management session, confirmation, fence, expiry, and cleanup.

type ProductionTemporaryNetworkWiring added in v0.4.0

type ProductionTemporaryNetworkWiring struct {
	Provider ProductionTemporaryNetworkProvider
	// contains filtered or unexported fields
}

ProductionTemporaryNetworkWiring owns the only network capabilities that production serve may receive. It exposes neither a broker, socket, nor a reusable HTTP client. Close is idempotent and owned by ProductionDependencies.

func NewProductionTemporaryNetworkWiring added in v0.4.0

func NewProductionTemporaryNetworkWiring(provider ProductionTemporaryNetworkProvider, closeFn func() error) (*ProductionTemporaryNetworkWiring, error)

NewProductionTemporaryNetworkWiring validates and wraps a provider that mints one temporary session and one lease per request.

func (*ProductionTemporaryNetworkWiring) Close added in v0.4.0

Close releases provider-owned resources exactly once, including when later serve wiring or startup cancellation rejects the composition.

type ServiceStatusSnapshot

type ServiceStatusSnapshot struct {
	RuntimeDir string
	PIDPath    string
	PID        int
	HasPIDFile bool
	Running    bool
	Stale      bool
}

ServiceStatusSnapshot is the CLI/GUI-visible process state for CheeseWAF. GUI and TUI must use this rather than inventing a second status model.

func InspectServiceStatus

func InspectServiceStatus() (ServiceStatusSnapshot, error)

InspectServiceStatus returns whether CheeseWAF appears to be running based on the configured runtime PID file. Safe for concurrent GUI polling.

func StopRunningService

func StopRunningService() (ServiceStatusSnapshot, error)

StopRunningService stops a live CheeseWAF process (or cleans a stale PID file). It reuses the same semantics as `cheesewaf stop`.

Directories

Path Synopsis
Package clilang provides CLI locale resolution and message catalogs.
Package clilang provides CLI locale resolution and message catalogs.
Package migration exposes the local CLI wrapper for the protected temporary-to-production migration contract.
Package migration exposes the local CLI wrapper for the protected temporary-to-production migration contract.
Package tui provides tui functionality for CheeseWAF.
Package tui provides tui functionality for CheeseWAF.

Jump to

Keyboard shortcuts

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