perch-agentkit

module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2026 License: MIT

README

perch-agentkit

Shared Go code of the Perch device daemons: the Perch Network Collector and the Perch AP Daemon. Both dial the Perch Network Controller over a WebSocket, speak JSON-RPC 2.0 on it and push on a schedule the controller sets, so that part lives here once.

Package What
rpc JSON-RPC 2.0, one object per WebSocket message: codec, dispatcher, requests, notifications
link One session to the controller: dial (TLS options, subprotocol, optional permessage-deflate), pings, serving the controller's requests, routing its notifications, calls of our own, the push scheduler driven by agent.configure, reconnect backoff, the controller's HTTP error bodies
hoststat Typed readers for /proc: load, memory, interface counters, conntrack fill, SNMP counters, default-route interfaces, over a root that tests can point at a fixture tree

Reconnect policy is the daemon's: link.Run is one session and returns why it ended (a *link.StatusError for a refused upgrade, the close code otherwise).

Go 1.22 or newer (the OpenWrt SDK floor); one dependency, github.com/coder/websocket. No cgo.

go test ./...
GOTOOLCHAIN=go1.22.12 go test ./...

MIT licensed.

Directories

Path Synopsis
Package hoststat reads the kernel's view of the host from /proc: load, memory, interface counters, connection tracking, SNMP counters and the default routes.
Package hoststat reads the kernel's view of the host from /proc: load, memory, interface counters, connection tracking, SNMP counters and the default routes.
Package link keeps an agent's WebSocket session to the Perch controller: dial with the agent's credentials, keep the connection alive with pings, serve the controller's JSON-RPC requests, route its notifications, make calls of the agent's own and push on the schedule the controller sets.
Package link keeps an agent's WebSocket session to the Perch controller: dial with the agent's credentials, keep the connection alive with pings, serve the controller's JSON-RPC requests, route its notifications, make calls of the agent's own and push on the schedule the controller sets.
Package rpc is JSON-RPC 2.0 over whole WebSocket messages: one object per frame, no batches.
Package rpc is JSON-RPC 2.0 over whole WebSocket messages: one object per frame, no batches.

Jump to

Keyboard shortcuts

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