agent

package
v3.136.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package agent runs the sensor: it loads rules from the feeds, registers with what compiled, serves the proxies, ships events and applies decisions.

Losing the platform does not stop the sensor. Rules already compiled keep running, decisions already applied keep applying, and events wait in a bounded queue until the uplink answers again. If the queue fills, the oldest events are dropped and the count is reported with the next batch, so a gap is visible rather than silent.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToDecision

func ToDecision(d uplink.Decision) decide.Decision

ToDecision converts a platform decision for the verdict engine.

Types

type Agent

type Agent struct {
	Verdicts *decide.Engine
	Rules    *proxy.Rules
	// contains filtered or unexported fields
}

Agent is a running sensor.

func New

func New(cfg Config) *Agent

New builds an agent. The proxies in cfg are wired to its verdict engine and rule set.

func (*Agent) Enqueue

func (a *Agent) Enqueue(e uplink.Event)

Enqueue adds an event to the outbound queue.

func (*Agent) Flush

func (a *Agent) Flush(ctx context.Context)

Flush posts the queue in batches of 500. A batch that fails goes back to the front of the queue.

func (*Agent) RefreshRules

func (a *Agent) RefreshRules(ctx context.Context) []uplink.RuleLoad

RefreshRules fetches every feed and, when any changed, compiles and installs the merged rule set. It returns the rule loads to report, or nil when nothing changed or nothing could be fetched.

func (*Agent) Run

func (a *Agent) Run(ctx context.Context) error

Run serves until ctx ends.

type Config

type Config struct {
	SensorKey string
	Version   string
	Mode      decide.Mode
	Hold      time.Duration
	Facts     host.Facts

	Feeds  []*feed.Source
	Uplink *uplink.Client

	// Reverse is nil when the sensor does not front a port; Egress is nil
	// when it does not proxy outbound calls.
	Reverse       *proxy.Reverse
	ReverseListen string
	Egress        *proxy.Egress
	EgressListen  string

	FeedEvery      time.Duration
	HeartbeatEvery time.Duration
	FlushEvery     time.Duration
	QueueLimit     int

	Logf func(string, ...any)
}

Config is how the sensor is run.

Jump to

Keyboard shortcuts

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