config

package
v0.0.0-...-b9240f0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: Apache-2.0 Imports: 2 Imported by: ? 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 config defines the DesiredState the server pushes down to an agent over the persistent WebSocket channel. Monitoring targets are configured centrally in Lite and pushed on connect and on every config change — the agent never listens, and users don't edit agent config files (low friction).

Index

Constants

View Source
const (
	TraceModeICMP = "icmp"
	TraceModeTCP  = "tcp"
)

Traceroute modes (telemetry.TraceResult.Mode). ICMP and TCP are executed independently; there is no automatic fallback between them at execution time. The mode is no longer part of a pushed request — the agent picks it from the probe kind that failed — but the vocabulary stays here because it is shared with the stored report and the console.

View Source
const (
	ProxyTypeSOCKS5    = "socks5"
	ProxyTypeHTTP      = "http"
	ProxyTypeWireGuard = "wireguard"
)

Proxy types.

View Source
const (
	DefaultProxyConnectTimeout = 5 * time.Second
	DefaultWireGuardMTU        = 1420
)

Proxy dial/handshake defaults.

DefaultProxyConnectTimeout bounds reaching the proxy and completing its handshake, SEPARATELY from the probe's own timeout: the two failures are different diagnoses, and a proxy that hangs must not consume the whole probe budget and then be reported as a target timeout.

DefaultWireGuardMTU is the conventional WireGuard tunnel MTU (1500 minus the 60-byte IPv6+UDP+WireGuard worst-case overhead).

View Source
const (
	ProxyDNSLocal  = "local"
	ProxyDNSRemote = "remote"
)

Proxy DNS resolution modes — WHERE the target hostname is resolved.

ProxyDNSLocal (the default) resolves on the agent, so the agent's target-access policy still vets the concrete address and the resolved literal IP is what gets handed to the proxy. That keeps the DNS-rebinding defense intact: the name is resolved exactly once and the address the policy approved is the address the proxy connects to.

ProxyDNSRemote hands the hostname to the proxy instead. It is the only mode that works when the target name only resolves correctly on the proxy's side (split-horizon DNS), but the agent can no longer vet the final address — only the name, pre-resolution. Callers must treat it as the weaker mode it is.

View Source
const (
	DefaultICMPInterval    = 10 * time.Second
	DefaultGatewayInterval = 10 * time.Second
	DefaultDNSInterval     = 30 * time.Second
	DefaultHTTPInterval    = 30 * time.Second
	DefaultTCPInterval     = 30 * time.Second
	DefaultNATInterval     = 30 * time.Minute
	// DefaultTraceInterval is the route-monitor cadence. A route rarely
	// changes and one sweep is up to MaxHops×AttemptsPerHop probes, so the
	// default is minutes, not seconds; MinTraceInterval is the floor a server
	// validates and an agent enforces regardless of what it is pushed.
	DefaultTraceInterval = 10 * time.Minute
	MinTraceInterval     = 5 * time.Minute
)

Default per-target check intervals: the schedState fallback a collector uses when a target sets no IntervalSeconds. icmp/gateway run on the fast base tier, dns/http/tcp on the regular tier, and NAT rarely (a full discovery is several round-trips and its result changes seldom).

View Source
const (
	DefaultTraceMaxHops        = 30
	DefaultTraceAttemptsPerHop = 3
	DefaultTraceTCPPort        = 443
	// DefaultTraceCycleDeadline bounds one periodic sweep when a target sets no
	// GlobalTimeoutMs. Shorter than the incident-diagnosis budget: a route
	// sample that needs minutes is better reported partial than late.
	DefaultTraceCycleDeadline = 2 * time.Minute
)

Trace monitor sweep shape (ProbeParams Trace* fields at zero).

View Source
const (
	DefaultPingCount       = 5
	DefaultPingEchoTimeout = time.Second
)

ICMP cycle shape. One cycle sends DefaultPingCount echoes by default, each bounded by DefaultPingEchoTimeout.

The echoes are NOT a burst: after every echo the collector recomputes the gap to the next one as "time left until this target is due again, divided by the echoes still to send", so a healthy cycle spreads its packets evenly across the whole check interval (5 packets over a 10s interval → one roughly every 2.25s) and the loss/jitter it reports describe the entire interval rather than a ~1s window at the top of it.

A lost or errored echo instead sends the next one immediately. That fail-fast is what keeps spreading from costing alert latency: a target that is fully down finishes its cycle — and therefore its 100%-loss round — in count×perEcho (5×1s by default), no slower than the old fixed-spacing burst. So the two bounds below are the two shapes a cycle can take, and CycleDeadline is their max.

View Source
const (
	DefaultDNSTimeout           = 3 * time.Second
	DefaultTCPTimeout           = 5 * time.Second
	DefaultHTTPTimeout          = 10 * time.Second
	DefaultNATPerRequestTimeout = 3 * time.Second
	// DefaultNATCycleDeadline bounds one whole NAT discovery (binding + filtering
	// + mapping with a couple of retries) when a target sets no GlobalTimeoutMs.
	DefaultNATCycleDeadline = 25 * time.Second
)

Per-probe default timeouts (used when a target sets no TimeoutMs / global).

View Source
const DefaultUploadInterval = 30 * time.Second

DefaultUploadInterval is the agent's default WAL batch-upload cadence (mirrors the agent envcfg default). The server uses it as the StaleAfter fallback when an agent has not (yet) reported its own upload interval, so a freshly-connected or pre-generation agent still gets link-latency slack in its freshness window.

30s rather than a few seconds because every upload is one server-side write transaction, and in SQLite each commit rewrites every touched 4 KiB page into the WAL (and again at checkpoint). At the design scale — 50 agents × 20 monitors — a 5s cadence puts the server past 100 GB/day of block writes for megabytes of actual data; 30s cuts the commit count 6× and batches several probe rounds per series into each page rewrite. Latency-sensitive paths do not ride on this: game seconds drain on their own capped interval, and fault confirmation only ever waits out at most one upload of backlogged rounds.

View Source
const MaxSweepPayloadSize = 1232

MaxSweepPayloadSize is the largest payload a size sweep may use. A sweep size above it fragments on the smallest supported tunnel MTU (1280, the IPv6 minimum — see DefaultSweepSizes), producing exactly the size-correlated loss the sweep classifies as physical-layer degradation — the false diagnosis the feature exists to avoid. Both the default sweep and the server's per-target validation are capped here.

Variables

View Source
var DefaultSweepSizes = []int{64, 512, 1232}

DefaultSweepSizes is the built-in payload set a size-sweeping cycle probes when a target turns on SizeSweep without listing its own PayloadSizes. The two ends straddle typical internet and LAN MTUs without exceeding them — and, critically, without exceeding the SMALLEST egress MTU a tunneled target can impose. 64 is the smallest common probe payload; 1232 is the largest ICMP payload that fits a 1280-byte tunnel (the smallest supported WireGuard MTU, and the IPv6 minimum) unfragmented in BOTH address families (1232 + 48 IPv6 / + 28 IPv4 = 1280), so a tunneled sweep's biggest bucket cannot fragment and manufacture the size-correlated loss the sweep is built to detect; 512 splits the difference. A PMTU/fragmentation issue is therefore never mistaken for the CRC/optics loss the sweep means to find.

Functions

func AnyProxyCapable

func AnyProxyCapable(kind string, p ProbeParams) bool

AnyProxyCapable reports whether a kind/params combination can use at least one proxy type. The console uses it to decide whether to show the proxy picker at all, so a gateway or host monitor never grows a control that could only be left empty.

func CycleDeadline

func CycleDeadline(kind string, p ProbeParams) time.Duration

CycleDeadline is the worst-case wall-clock a single probe cycle can take for a target, matching each collector's own bounding:

  • icmp/gateway: GlobalTimeoutMs when set, else max(interval, count×perEcho).
  • dns/tcp/http: TimeoutMs when set, else the per-kind default.
  • nat: GlobalTimeoutMs when set, else the default whole-cycle deadline.

The icmp/gateway max is the two cycle shapes described above. A healthy cycle spreads its echoes across the interval, and paces them so that every echo still to come fits its full per-echo timeout before the interval ends — so it completes by the next due instant, bounded by the interval. A failing cycle fail-fasts to back-to-back echoes — bounded by count×perEcho. Neither bound implies the other (a 1s interval with 5 packets is count-bound; a 5-minute interval is interval-bound), so the deadline is whichever is larger. When the count bound wins the echoes cannot fit the interval at all, and the pacing degenerates to back-to-back, which is that same bound.

Note for StaleAfter callers: whenever the interval branch wins, cycle ≤ interval, so StaleAfter's base collapses to 3×interval — the same window the old fixed-spacing burst produced. Spreading a cycle out therefore does not widen any freshness window on its own.

func EffectiveInterval

func EffectiveInterval(kind string, p ProbeParams) time.Duration

EffectiveInterval is a target's per-check interval before the agent-local MinProbeInterval floor: the configured IntervalSeconds when > 0, else the collector default for the kind. It does NOT apply the MinProbeInterval floor — callers that need the reported effective schedule apply that floor themselves.

func KnownProxyType

func KnownProxyType(t string) bool

KnownProxyType reports whether t is a compiled proxy type.

func PingCount

func PingCount(p ProbeParams) int

PingCount is the number of echoes one ICMP cycle sends for these params: PacketCount when set (>0), else the default burst. It is shared by the ICMP collectors and CycleDeadline so the per-cycle timing and the reported deadline can never disagree.

A size sweep (ProbeParams.SizeSweep) multiplies the count by the number of swept sizes: the cycle sends PingCount-per-size echoes, round-robin across sizes, so each size's loss is as statistically meaningful as a normal cycle's and the per-size comparison the sweep exists for can actually be drawn. Both the agent's cycle length and the server's freshness / round-completeness checks read this one function, so the longer cycle is never misread as stale.

func PingEchoTimeout

func PingEchoTimeout(p ProbeParams) time.Duration

PingEchoTimeout is the per-echo timeout for an ICMP cycle: the configured TimeoutMs when > 0, else the default.

func ProxyCapable

func ProxyCapable(kind string, p ProbeParams, proxyType string) bool

ProxyCapable reports whether a probe of this kind, with these params, can run through a proxy of this type.

This is the ONE source of truth for the capability matrix, shared by the server's save-time validation, the agent's monitor evaluation, and the console's proxy picker, so the three can never disagree about what is offerable, savable, and runnable.

The matrix follows from what each transport can actually carry:

kind     | socks5            | http              | wireguard
---------+-------------------+-------------------+----------
http     | yes               | yes               | yes
tcp      | yes               | yes               | yes
dns      | yes               | stream protos only| yes
nat      | yes               | tcp/tls only      | yes
icmp     | no                | no                | yes
gateway  | no                | no                | no
host     | no                | no                | no

The three columns differ by what the transport can forward, not by convenience:

  • SOCKS5 forwards TCP (CONNECT) AND UDP (UDP ASSOCIATE), so every datagram probe except ICMP works. It has no ICMP relay at all — the protocol has no command for it — so ping stays tunnel-only.
  • HTTP has only CONNECT, which tunnels a TCP byte stream. Plain-UDP DNS and STUN over udp/dtls therefore cannot traverse it, and are refused rather than offered and then failed every cycle.
  • WireGuard carries raw IP, so it carries everything the agent probes.

A gateway probe targets the local first hop, where an egress proxy has no meaning at all, and host is a server-side anchor that is never pushed.

func StaleAfter

func StaleAfter(interval, cycle, upload time.Duration) time.Duration

StaleAfter is the freshness window after which a sample is considered stale: max(3×interval, interval + 2×cycle) + 2×upload.

The sample timestamp is the probe instant, but a sample does not reach the server store at that instant: the agent buffers results in its WAL and flushes them on a batch-upload cadence (upload), then the server drains and ingests them. The freshness window must tolerate this whole probe→arrival link, or a short-interval target (10s → a ~30s window) is marked stale on nothing more than ordinary batching jitter. The base term is the probe cadence itself: max(3×interval, interval + 2×cycle) tolerates a couple of missed cycles while keeping a legitimately long cycle (the 25s NAT discovery, an ICMP target given a GlobalTimeoutMs longer than its interval) from tripping stale mid-run. The +2×upload term adds the link slack: 2× (not 1×) covers a sample that just missed one batch boundary plus one upload retry.

upload ≤ 0 falls back to DefaultUploadInterval (the server's value when the agent has not reported its own).

func SweepSizes

func SweepSizes(p ProbeParams) []int

SweepSizes returns the payload sizes a size-sweeping cycle probes: the target's PayloadSizes when set, else the built-in default sweep. The slice is returned as-is and never mutated; callers that need a stable copy must copy.

Types

type DesiredState

type DesiredState struct {
	ConfigVersion int           `json:"config_version"`
	ProbeTargets  []ProbeTarget `json:"probe_targets"`
	Intervals     Intervals     `json:"intervals"`
	// Proxies are the egress proxies referenced by the targets above — only those
	// actually referenced, and only those still enabled. A target whose ProxyID has
	// no entry here is deliberately left in ProbeTargets so the agent reports it as
	// a proxy-missing operational issue: dropping it server-side would make a
	// disabled proxy look like a deleted monitor.
	Proxies []ProxySpec `json:"proxies,omitempty"`
	// Game is the game-profile configuration for the site. Nil means the server
	// has nothing to say about game capture; an empty-but-present block is a
	// deliberate "record everything, no profiles defined".
	Game *GameConfig `json:"game,omitempty"`
	// Diag is the path-diagnostic policy the agent applies to its own traceroute
	// trigger. Nil means this server has nothing to say and the agent's built-in
	// defaults stand — which is also what an agent reporting to several servers
	// needs, since each server states its policy independently.
	Diag *DiagPolicy `json:"diag,omitempty"`
}

DesiredState is the monitoring configuration for one agent. The agent applies it and echoes ConfigVersion back in every MonitorStatus frame, which is how the server tells when the agent is up to date.

type DiagPolicy

type DiagPolicy struct {
	Enabled             bool `json:"enabled"`
	ConsecutiveFailures int  `json:"consecutive_failures,omitempty"`
	// Serial orders policy updates, mirroring what ConfigVersion does for the
	// probe half and GameConfig.Version for the game half. The server bumps it
	// on every diag_* settings change; the agent applies a policy only when the
	// serial is newer than what it holds. It is its own axis because the other
	// two serials do not move when only the diagnostic numbers change, and
	// DesiredState builds can be delivered out of build order — unversioned,
	// a stale enabled=true arriving last would keep tracing after the operator
	// turned diagnostics off.
	Serial uint64 `json:"serial,omitempty"`
	// CooldownSeconds is the minimum spacing between two traces of the SAME
	// destination on this agent. Without it a target that stays down would be
	// traced on every subsequent failing round, spending the machine's probe
	// budget re-measuring a path whose answer has not changed.
	CooldownSeconds int `json:"cooldown_seconds,omitempty"`
	MaxHops         int `json:"max_hops,omitempty"`
	Attempts        int `json:"attempts,omitempty"`
	// PerHopTimeoutMs bounds one probe attempt. Zero lets the agent derive it
	// from BudgetMs and MaxHops, which is the sane relationship; setting it is
	// for installs whose links need a longer or shorter wait than that implies.
	PerHopTimeoutMs int `json:"per_hop_timeout_ms,omitempty"`
	// BudgetMs is the whole sweep's wall-clock ceiling.
	BudgetMs int `json:"budget_ms,omitempty"`
}

DiagPolicy says when an agent may traceroute a target it has just decided is down, and how far the sweep may go. The server no longer commands the execution — the agent notices the failure and acts, because the moment worth tracing is precisely the moment the link to the server is least trustworthy — but it remains the policy source, so the numbers still come from here.

Why it is global and not per target

It answers "how eager is this install about path diagnostics", which is an install-level question. A per-target copy would have to be re-pushed on every unrelated monitor edit to keep saying the same thing, and would invite a configuration where two monitors on one destination disagree about whether it may be traced.

ConsecutiveFailures deliberately matches the server's own availability confirmation threshold: the agent's streak is counting the same rounds the server would count, so a trace fires as the fault is confirmed rather than before it (noise) or long after (evidence collected past the interesting moment). A zero field means "use the agent's built-in default", never zero.

type GameConfig

type GameConfig struct {
	Version int `json:"version"` // sites.game_config_serial — independent of ConfigVersion
	// RecordUnmatched decides what happens to a presenting process that matches
	// no profile: recorded as an "other process" run, or ignored. It is a site
	// setting rather than a per-profile one because it is a privacy choice about
	// the machine, not a measurement choice about a game.
	RecordUnmatched bool          `json:"record_unmatched"`
	Profiles        []GameProfile `json:"profiles,omitempty"`
}

GameConfig is the site's game-capture configuration: which processes count as which game, and whether everything else is worth recording at all.

Version is its own axis, deliberately not ConfigVersion. The two describe unrelated things that change at unrelated times: renaming a game profile has nothing to say to a ping monitor, and bumping ConfigVersion for it would make every agent re-evaluate every probe target and restart the ones whose serial it cannot prove unchanged. Keeping the serials apart means a profile edit re-pushes DesiredState with an unchanged ConfigVersion — the probe side no-ops — and a probe edit re-pushes it with an unchanged game Version, so the sensor is not restarted for a change it cannot see (product doc §13).

type GameProfile

type GameProfile struct {
	ID        string   `json:"id"`
	Name      string   `json:"name"`
	Exe       []string `json:"exe"`                  // case-insensitive process names
	TargetFPS int      `json:"target_fps,omitempty"` // 0 = unset
	Tier      string   `json:"tier"`                 // "base" | "diag"
}

GameProfile is one named game as the agent needs it.

The profile's monitor_ids are deliberately absent: linking a game to network monitors only affects how a run is charted in the console, and the agent would carry the list across every push without ever reading it. Anything the agent cannot act on stays server-side.

type Intervals

type Intervals struct {
	BaseSeconds    int `json:"base_seconds"`
	RegularSeconds int `json:"regular_seconds"`
}

Intervals controls the agent scheduler tiers (seconds).

type ProbeParams

type ProbeParams struct {
	// Common — applies to every protocol.
	IntervalSeconds int `json:"interval_seconds,omitempty"` // per-target check interval; 0 = fall back to the collector default
	TimeoutMs       int `json:"timeout_ms,omitempty"`       // per-probe timeout

	// ICMP / Ping.
	PacketSize      int `json:"packet_size,omitempty"`       // ICMP echo payload bytes
	PacketCount     int `json:"packet_count,omitempty"`      // total echoes per cycle; 0 = collector default
	GlobalTimeoutMs int `json:"global_timeout_ms,omitempty"` // overall deadline across all echoes in one cycle
	// SizeSweep probes each cycle at several ICMP echo payload sizes instead of
	// one fixed PacketSize, so the server can separate size-correlated loss
	// (physical-layer degradation: optics / CRC / FEC / ASIC / policer) from
	// congestion, where loss is flat across sizes. PayloadSizes lists the swept
	// sizes; empty means the built-in default sweep (see config.SweepSizes). When
	// enabled the cycle sends PingCount(params) echoes PER size, round-robin
	// across sizes, so the total (count × len(sizes)) flows through PingCount —
	// the same single source the server's freshness and round-completeness checks
	// read, so the longer cycle is never mistaken for a stale or truncated one.
	SizeSweep    bool  `json:"size_sweep,omitempty"`
	PayloadSizes []int `json:"payload_sizes,omitempty"` // swept ICMP payload bytes; empty = default sweep

	// DNS.
	RecordType       string `json:"record_type,omitempty"`       // A | AAAA | CNAME | MX | TXT | NS (default A/AAAA)
	ResolverServer   string `json:"resolver_server,omitempty"`   // resolver IP/host override, or DoH URL (default: system resolver)
	ResolverPort     int    `json:"resolver_port,omitempty"`     // resolver port (default 53, or 853 for DoT)
	ResolverProtocol string `json:"resolver_protocol,omitempty"` // "" | udp | tcp | dot | doh (default plain UDP/system)

	// HTTP.
	Method           string            `json:"method,omitempty"`             // GET | HEAD | POST | … (default GET)
	AcceptedStatuses string            `json:"accepted_statuses,omitempty"`  // ranges/CSV e.g. "200-299,301"; empty = any 2xx/3xx
	Keyword          string            `json:"keyword,omitempty"`            // body keyword; ok requires presence (or absence when KeywordInvert)
	KeywordInvert    bool              `json:"keyword_invert,omitempty"`     // invert keyword match (fail when keyword present)
	Headers          map[string]string `json:"headers,omitempty"`            // request headers
	Body             string            `json:"body,omitempty"`               // request body (sent for non-GET/HEAD)
	MaxRedirects     int               `json:"max_redirects,omitempty"`      // max redirects to follow; <0 disables following
	IgnoreTLS        bool              `json:"ignore_tls,omitempty"`         // skip TLS certificate verification
	MaxResponseBytes int               `json:"max_response_bytes,omitempty"` // cap on body bytes read for keyword match (default 1 KiB)

	// TCP.
	Port int  `json:"port,omitempty"` // TCP port to connect to (also the STUN port for kind=nat; default 3478)
	TLS  bool `json:"tls,omitempty"`  // perform a TLS handshake after connect
	// FlowFanout probes a TCP or HTTP target through distinct pinned source ports
	// each cycle. TCP can expose a stable bad ECMP/LAG hash subset; HTTP repeats the
	// complete GET/HEAD acceptance check to expose stable service-branch differences.
	// 0/1 means normal single-flow behavior. Direct targets only; HTTP fan-out also
	// requires redirects to be disabled so every branch keeps one destination.
	FlowFanout int `json:"flow_fanout,omitempty"` // TCP/HTTP source-port fan-out count; 0 = off

	// NAT (STUN behavior discovery, RFC 5780 / RFC 4787).
	NATTransport string `json:"nat_transport,omitempty"` // "" | udp | tcp | tls | dtls (default udp); only udp does the filtering test + classic type
	STUNServer2  string `json:"stun_server2,omitempty"`  // optional 2nd STUN server host[:port] used as the mapping-test alternate when the primary lacks OTHER-ADDRESS

	// Gateway.
	Interface string `json:"interface,omitempty"` // NIC to resolve the gateway from, matched against IfaceInfo.ID or Name; "" = default interface

	// Trace (periodic route monitoring). A trace monitor runs one bounded
	// traceroute per interval and reports it as a TraceResult stamped with the
	// monitor id; TimeoutMs bounds one probe attempt and GlobalTimeoutMs the
	// whole sweep. Port is the destination port in TCP mode (default
	// DefaultTraceTCPPort). Only sent to an agent that declared the
	// probe-trace capability in its Hello; an older agent never sees the kind.
	TraceMode      string `json:"trace_mode,omitempty"`       // TraceModeICMP | TraceModeTCP (default icmp)
	MaxHops        int    `json:"max_hops,omitempty"`         // TTL ceiling; 0 = DefaultTraceMaxHops
	AttemptsPerHop int    `json:"attempts_per_hop,omitempty"` // probes per TTL; 0 = DefaultTraceAttemptsPerHop
}

ProbeParams carries per-target, per-protocol probe settings. Zero values mean "use the collector default", so an unconfigured target behaves as before.

type ProbeTarget

type ProbeTarget struct {
	// MonitorID is the stable server-side id of this monitor (probe_tasks.id).
	// The agent stamps it onto every Metric the probe emits so the server keys
	// series per monitor — two monitors on the same target string stay distinct.
	MonitorID string      `json:"monitor_id,omitempty"`
	Kind      string      `json:"kind"`           // "icmp" | "dns" | "http" | "tcp" | "nat" | "gateway" | "trace" (host is server-side only)
	Name      string      `json:"name,omitempty"` // human-friendly display name; optional
	Target    string      `json:"target"`         // "1.1.1.1", "example.com", "https://…"
	Params    ProbeParams `json:"params"`         // per-protocol probe settings (zero = collector defaults)
	// ProxyID pins this target's egress to one DesiredState.Proxies entry. Empty
	// means a direct dial. A non-empty id the agent cannot honor (absent spec, or a
	// type this kind cannot use) makes the monitor un-runnable rather than direct:
	// there is no fallback, by design.
	ProxyID string `json:"proxy_id,omitempty"`
	// ConfigSerial is this target's material config generation
	// (probe_tasks.config_serial) at push time. The agent echoes it on every
	// Metric (Metric.ConfigSerial) and MonitorStatusEntry (TargetConfigSerial)
	// the target produces, so the server can reject obsolete-generation samples
	// and distinguish a current-generation status report from a stale one.
	ConfigSerial int `json:"config_serial,omitempty"`
}

ProbeTarget is one monitoring target pushed to the agent.

type ProxySpec

type ProxySpec struct {
	ID   string `json:"id"`             // stable server-side proxy id (proxies.id)
	Name string `json:"name,omitempty"` // human-friendly display name
	Type string `json:"type"`           // ProxyType* — socks5 | http | wireguard
	// ConfigSerial is this proxy's material config generation. The agent keys its
	// built dialer on (id, config_serial) so an edited proxy is torn down and
	// rebuilt rather than kept alive on stale credentials or a stale connection.
	ConfigSerial int `json:"config_serial,omitempty"`

	// socks5 / http.
	Host             string `json:"host,omitempty"`               // proxy host or IP
	Port             int    `json:"port,omitempty"`               // proxy port
	Username         string `json:"username,omitempty"`           // optional auth
	Password         string `json:"password,omitempty"`           // optional auth (secret)
	DNSMode          string `json:"dns_mode,omitempty"`           // ProxyDNS* ("" = local)
	ConnectTimeoutMs int    `json:"connect_timeout_ms,omitempty"` // proxy-handshake budget; 0 = DefaultProxyConnectTimeout

	// wireguard (userspace tunnel).
	WGPrivateKey       string `json:"wg_private_key,omitempty"`     // this peer's private key, base64 (secret)
	WGPeerPublicKey    string `json:"wg_peer_public_key,omitempty"` // remote peer public key, base64
	WGPresharedKey     string `json:"wg_preshared_key,omitempty"`   // optional PSK, base64 (secret)
	WGEndpoint         string `json:"wg_endpoint,omitempty"`        // remote peer host:port
	WGAllowedIPs       string `json:"wg_allowed_ips,omitempty"`     // CSV of CIDRs routed into the tunnel
	WGLocalAddrs       string `json:"wg_local_addrs,omitempty"`     // CSV of this peer's in-tunnel addresses
	WGDNS              string `json:"wg_dns,omitempty"`             // CSV of in-tunnel resolvers
	WGMTU              int    `json:"wg_mtu,omitempty"`             // tunnel MTU; 0 = DefaultWireGuardMTU
	WGKeepaliveSeconds int    `json:"wg_keepalive_seconds,omitempty"`
}

ProxySpec is one egress proxy pushed to the agent. Credentials travel in the clear inside the already-authenticated agent WebSocket channel; they are never written to agent disk and never echoed back by the server's read APIs.

func (ProxySpec) DNSModeOrDefault

func (p ProxySpec) DNSModeOrDefault() string

DNSModeOrDefault returns the spec's DNS mode, defaulting to local. WireGuard resolves inside the tunnel and has no proxy-side alternative, so it always reports local regardless of what was stored.

func (ProxySpec) ProxyConnectTimeout

func (p ProxySpec) ProxyConnectTimeout() time.Duration

ProxyConnectTimeout is the spec's proxy-handshake budget, or the default when unset.

func (ProxySpec) WireGuardMTU

func (p ProxySpec) WireGuardMTU() int

WireGuardMTU is the spec's tunnel MTU, or the default when unset.

type SnapshotRequest

type SnapshotRequest struct {
	RequestID string   `json:"request_id"`
	Scopes    []string `json:"scopes,omitempty"`
}

SnapshotRequest is a one-shot ask for a live host snapshot, pushed to the agent as a standalone frame. Not versioned into ConfigVersion — it is transient and cleared once the matching snapshot arrives. Scopes are the requested process/connection permission IDs (e.g. host.process.basic.read); the agent evaluates each against its effective policy and always answers, reporting collected/denied/unsupported/failed per scope.

Jump to

Keyboard shortcuts

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