network

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package network hosts the daemon's host-network monitors. It is separate from the block-node component because the host firewall exists without shaping.

Index

Constants

View Source
const MonitorName = "network-reassert-monitor"

MonitorName is the monitor's name as reported by GET /status.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArtifactState

type ArtifactState struct {
	Artifact    string `json:"artifact"`
	Expected    bool   `json:"expected"`
	Present     bool   `json:"present"`
	ProbeFailed bool   `json:"probe_failed,omitempty"`
	Detail      string `json:"detail,omitempty"`
	// ReassertCount is how many times this artifact has been restored.
	ReassertCount int `json:"reassert_count"`
	// LastReassertedAt is when it was last restored, nil if never.
	LastReassertedAt *time.Time `json:"last_reasserted_at,omitempty"`
	// ConsecutiveFailures counts successive runs where the repair did not work.
	ConsecutiveFailures int `json:"consecutive_failures,omitempty"`
}

ArtifactState is one artifact's running history, as reported by GET /status.

type ComponentConfig

type ComponentConfig struct{}

ComponentConfig holds inputs needed to build the network component. Empty for now: what to check is decided per tick from the artifacts on disk.

type ComponentResult

type ComponentResult struct {
	// Monitors is the ordered slice of monitors to run under the supervisor.
	Monitors []daemonkit.MonitorRunner

	// ReassertMonitor is the presence-check monitor, exposed for GET /status.
	ReassertMonitor *ReassertMonitor
}

ComponentResult contains the monitors built by NewComponent.

func NewComponent

func NewComponent(_ ComponentConfig) (ComponentResult, error)

NewComponent constructs the network component's monitors. Nothing is gated here; the monitor decides per tick whether the host has anything to check.

type ReassertMonitor

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

ReassertMonitor periodically runs `network reassert` under sudo and keeps the history that GET /status reports.

func NewReassertMonitor

func NewReassertMonitor() *ReassertMonitor

NewReassertMonitor constructs a ReassertMonitor wired to the sudo-backed delegator.

func (*ReassertMonitor) Name

func (m *ReassertMonitor) Name() string

Name implements daemonkit.MonitorRunner.

func (*ReassertMonitor) Run

func (m *ReassertMonitor) Run(ctx context.Context) error

Run implements daemonkit.MonitorRunner. It checks after reassertStartupGrace, then every reassertInterval. A worker-exec failure is returned so the supervisor backs off.

func (*ReassertMonitor) Snapshot

func (m *ReassertMonitor) Snapshot() Snapshot

Snapshot returns a copy of the current history. Safe for concurrent use.

type Snapshot

type Snapshot struct {
	// LastCheckAt is when a run last probed something, nil before the first one.
	LastCheckAt *time.Time `json:"last_check_at,omitempty"`
	// LastError is the most recent worker-exec failure, cleared on the next success.
	LastError string `json:"last_error,omitempty"`
	// Artifacts is nil until the first successful run.
	Artifacts []ArtifactState `json:"artifacts,omitempty"`
}

Snapshot is the component payload served under GET /status.

Jump to

Keyboard shortcuts

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