agent

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: MPL-2.0 Imports: 27 Imported by: 0

README

Agent orchestration

agent.go owns serialized desired-state and runtime activation. Utility jobs use two bounded workers; they submit traffic captures back to the actor instead of mutating sampling baselines concurrently.

accounting.go samples logical payload counters every second, retains separate authorization accounting periods, publishes measured byte rates, and seals durable flush barriers. Quiescing requires fenced admission and waits for native handlers, including final bytes after admission slots were released.

jobs.go persists bounded mutation replay history. job_privacy.go excludes session/IP scans, machine metrics and history reads from disk. Live read replay data remains in process memory. Corrupt or unwritable history fails construction.

Hosted cases in accounting_test.go and job_privacy_test.go verify closed-stream attribution and transient read results. Real stream tests live with the runtime.

Documentation

Overview

Package agent serializes authoritative state while utility work runs independently.

Index

Constants

This section is empty.

Variables

View Source
var Capabilities = []string{"native_xray", "multi_inbound", "tcp_udp_limits", "session_revocation", "traffic_ack", "certificates", "ddns", "smartdns", "geodata", "nftables", "port_forward", "metrics", "logs", "peer_speedtest", "torrent_ban", "signed_updates", "traffic_periods_v1", "measured_user_rates", "authorization_expiry", "member_outbound_guards", "traffic_period_barriers_v1", "config_validation_v1"}

Functions

This section is empty.

Types

type Agent

type Agent struct {
	Dir          string
	Version      string
	BootID       string
	Store        *state.Store
	Registry     *sessions.Registry
	Runtime      *xray.Runtime
	Client       *transport.Client
	Logs         *nlog.Stream
	Sampler      *monitor.Sampler
	Certificates *cert.Pool
	Firewall     *firewall.Manager
	Updater      *updatepkg.Manager
	Runner       host.Runner
	Jobs         *Jobs
	// contains filtered or unexported fields
}

func New

func New(dir, version string, client *transport.Client, logs *nlog.Stream) (*Agent, error)

func (*Agent) Run

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

type JobResult

type JobResult struct {
	ID       string    `json:"id"`
	Command  string    `json:"command"`
	Status   string    `json:"status"`
	Data     any       `json:"data,omitempty"`
	Error    string    `json:"error,omitempty"`
	Finished time.Time `json:"finished,omitempty"`
}

type Jobs

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

func NewJobs

func NewJobs(dir string, send func(protocol.Message, bool) bool) (*Jobs, error)

func (*Jobs) Cancel

func (j *Jobs) Cancel(id string) bool

func (*Jobs) Snapshot

func (j *Jobs) Snapshot() []JobResult

func (*Jobs) Start

func (j *Jobs) Start(ctx context.Context, id, command string, fn func(context.Context, func(any)) (any, error)) error

Jump to

Keyboard shortcuts

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