Documentation
¶
Overview ¶
Package remote implements wrongtop's read-only remote monitoring protocol: a token-authenticated TCP handshake followed by a stream of length-prefixed JSON collector snapshots. Clients only ever receive data — the protocol carries no commands by design.
Index ¶
Constants ¶
const DefaultPort = 61234
DefaultPort is used by serve and connect when none is specified.
const MaxFrame = 16 << 20
MaxFrame caps one frame's payload; snapshots stay orders of magnitude below this even on busy machines.
const Protocol = "WRONGTOP/1"
Protocol is the protocol identifier verified in the handshake.
Variables ¶
This section is empty.
Functions ¶
func Authorize ¶
Authorize reports whether the provided token matches the expected one, comparing in constant time. An empty expected token never matches, so a misconfigured server refuses everyone instead of anyone.
func ReadFrame ¶
ReadFrame reads one length-prefixed JSON frame into v. Payloads above max bytes are rejected before allocation.
Types ¶
type Auth ¶
type Auth struct {
Token string `json:"token"`
}
Auth is the first frame a client sends after connecting.
type Client ¶
type Client struct {
Hello Hello
// contains filtered or unexported fields
}
Client is the TUI side of the protocol: dial, authenticate, then pull snapshots one by one.
type Hello ¶
type Hello struct {
Protocol string `json:"protocol"`
Version string `json:"version,omitempty"`
Hostname string `json:"hostname,omitempty"`
RefreshMS int `json:"refresh_ms"`
}
Hello is the first frame the server sends after successful auth.
type Options ¶
type Options struct {
// Listen is the TCP address to bind, e.g. ":61234".
Listen string
// Token clients must present; Serve refuses to start without one.
Token string
// Refresh is the snapshot cadence (floored at 250ms).
Refresh time.Duration
// Version is reported in the Hello frame.
Version string
}
Options configures Serve.