ops

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package ops serves the operator API on the tunnel SNI: this boot's logs with resume cursors, a status summary, and the policy. The TLS layer has already verified the client certificate against the client CA; here its SPIFFE role decides what it may do. Operators (ops/<name>) may do everything; log readers (logs/<name>) may read logs, status, and the policy; dark nodes (node/<name>) may do nothing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplyFunc

type ApplyFunc func(policy []byte) (Outcome, error)

ApplyFunc stores and applies a policy.yml body. A *config.InvalidError is the body's fault.

type Handler

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

func New

func New(cfg config.Config, policy []byte, bootID, dir string) *Handler

New serves cfg's logs and status. policy is the policy.yml cfg was parsed with, as stored.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Handler) SetApply

func (h *Handler) SetApply(fn ApplyFunc, reboot func())

SetApply registers the policy PUT. reboot runs after the response is flushed when the change cannot be applied in place.

func (*Handler) SetConfig

func (h *Handler) SetConfig(cfg config.Config)

SetConfig swaps the config later requests see, so status follows a policy applied in place.

func (*Handler) SetMetrics added in v0.3.0

func (h *Handler) SetMetrics(fn func(*metrics.Writer))

SetMetrics registers what /~!ops/metrics writes after the build and boot time.

func (*Handler) SetStatus

func (h *Handler) SetStatus(fn func() map[string]any)

type Outcome

type Outcome struct {
	Reboot bool
	Cfg    config.Config
}

Outcome is what applying a policy did. Reboot means the process must restart into it; otherwise the caller already applied it.

Jump to

Keyboard shortcuts

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