Documentation
¶
Overview ¶
Package protocol defines the shared wire contract used by the agent, the server, and (later) the cloud server. The type packages (telemetry, config, enroll, permission) deliberately have no external dependencies so every consumer can import them without pulling in server or agent code (architecture §15.2-3: one shared protocol, no forks).
The one exception is the opt-in protocol/wire codec, which adds protobuf as a compact alternative to JSON on the telemetry hop. Only consumers that import protocol/wire pull google.golang.org/protobuf; the type packages stay dependency-free.
Index ¶
Constants ¶
const SchemaVersion = 8
SchemaVersion is the current wire schema version. Bump it for breaking changes; additive changes (new optional fields, new string enum values) keep the same version and must be tolerated by consumers.
3 removed two fields from GameBucket — the whole-adapter telemetry and the busiest logical core — and moved them to a stream of their own keyed by (agent, second), alongside a new collection for the stretches a game produced no frames. Removals are what make it breaking: a peer still speaking 2 sends readings this build has no field for, and expects none of what replaced them.
4 redefined what probe.icmp.loss_pct is a ratio OF. It used to be the target's configured packet count; it is now the echoes the agent actually sent, which it reports alongside as probe.icmp.sent. The field did not move and no field was removed, which is exactly why this needs the version: nothing about the wire shape betrays the change, so a 3 server would read a 4 agent's rounds happily and read them wrong. It would take a round truncated by the agent's probe-concurrency budget — one echo of five, reporting 100% because the one was lost — as a full round's 100% and confirm an outage, which is the precise false fault the sent count was added to prevent. Bumping refuses that pairing at the handshake instead.
5 moved traceroute from a server-issued command to an agent-local trigger. Two frame variants went away (trace_request, trace_result), the result now rides Packet as a self-describing record, and DesiredState gained the policy block that governs the agent's own trigger. A 4 server paired with a 5 agent would push commands nothing listens for and would drop the results arriving inside packets it otherwise parses perfectly — a mismatch whose only symptom is a diagnostic feature that silently never produces anything.
6 removed reported_config_version from Hello and Packet (Hello field 6, Packet field 9 — both reserved, never to be reused). The server stored it and nothing ever read it back; the live "what config has the agent applied" signal is the MonitorStatus frame's config-version echo. The removal is what makes it breaking: a 5 agent still stamps the field on every packet and a 6 server has no slot for it — both codecs would skip it silently (encoding/json ignores unknown fields, and protobuf skips unknown field numbers), and a silent skip is exactly the ambiguity an exact-match handshake exists to refuse.
7 did to the incident scene what 5 did to traceroute. Two more frame variants went away (incident_snapshot_request, incident_snapshot — Frame fields 8 and 10, reserved), and the scene now rides Packet as a self-describing SceneReport the agent collects on its own fault edges. The pairing has to be refused rather than tolerated in either direction: a 6 server would push scene requests nothing answers and would drop the reports arriving inside packets it otherwise parses, while a 6 agent would answer on a frame the 7 server no longer accepts. Either way the symptom is an evidence feature that silently produces nothing, in exactly the outages it exists for.
8 added the protocol's first negotiation-and-recovery state machines: capability negotiation, the pre-claim sequence-floor barrier, and the controlled credential/epoch rotation. Hello carries the wire capabilities the agent speaks and the enrollment epoch of the credential it presents; five new control frames (sequence_floor, sequence_floor_applied, epoch_rotation_challenge, epoch_rotation_request, epoch_rotation_result) ride the Frame envelope. What makes it breaking is the state machine a peer must run, not a wire-shape removal: a 7 server would skip the new frames as unknown fields — the floor barrier would never establish and the agent would claim sequences the server cannot safely fence against a reset allocator — and a 7 agent declares no capabilities and cannot perform the rotation an 8 server depends on for conflict recovery. Both directions fail loudly at the handshake instead of limping along half-negotiated.
Variables ¶
This section is empty.
Functions ¶
func ValidateSchema ¶
ValidateSchema reports whether v is a schema version this build understands. The server calls this at ingress, and the agent on the reply, so a mismatched pair fails loudly at the handshake instead of quietly at the data.
Why this is an exact match and not a range ¶
It used to accept 1..SchemaVersion, which is the shape a system with deployed agents needs. Self-hosted builds have none: every agent and server binary in one install speaks the same schema, so a range here would not buy tolerance, it would buy silence: a peer speaking 2 would be admitted and every field 3 moved would be dropped on the floor with nothing anywhere saying so. That is the failure mode the version exists to prevent, and it is worse than a refused connection, which at least names the half of the install that needs upgrading. Deployments that must accept several schema versions side by side (a cloud gateway behind a rolling agent fleet) do so through an explicit per-version adapter registry — this function stays the exact "native schema of this build" check, and a range is never the mechanism.
Types ¶
This section is empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package config defines the DesiredState the server pushes down to an agent over the persistent WebSocket channel.
|
Package config defines the DesiredState the server pushes down to an agent over the persistent WebSocket channel. |
|
Package enroll defines the agent enrollment handshake (architecture §11).
|
Package enroll defines the agent enrollment handshake (architecture §11). |
|
Package gamesense defines the contract for game presentation data: the line-delimited JSON a sensor component writes on its stdout, the single config line the agent writes back on its stdin, and the run / second-bucket records the agent uploads from it.
|
Package gamesense defines the contract for game presentation data: the line-delimited JSON a sensor component writes on its stdout, the single config line the agent writes back on its stdin, and the run / second-bucket records the agent uploads from it. |
|
Package permission is the typed, immutable local-permission model shared by the agent (enforcement), the server (ingestion, pre-check, remediation), and the desktop trust-boundary exception.
|
Package permission is the typed, immutable local-permission model shared by the agent (enforcement), the server (ingestion, pre-check, remediation), and the desktop trust-boundary exception. |
|
Package telemetry defines the batched data packet an agent uploads to the server, matching the shape in the architecture doc §5.1.
|
Package telemetry defines the batched data packet an agent uploads to the server, matching the shape in the architecture doc §5.1. |
|
Package wire is the opt-in serialization codec for the NetTact agent <-> server WebSocket channel.
|
Package wire is the opt-in serialization codec for the NetTact agent <-> server WebSocket channel. |