protocol

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package protocol defines the wire format for the agent diag channel: nd-json frames over one long-lived HTTP/3 stream, demuxed by Id so multiple commands can interleave.

Index

Constants

View Source
const (
	ErrUnknownCommand   = "unknown_command"
	ErrInvalidArgs      = "invalid_args"
	ErrBusy             = "busy"
	ErrDeadlineExceeded = "deadline_exceeded"
	ErrInternal         = "internal"
)

Well-known error codes returned by the dispatcher. Commands may return their own codes too; these are reserved for transport-level failures.

View Source
const MimeType = "application/x-ndjson"

MimeType is the media type advertised on both halves of the diag stream.

View Source
const Path = "/diag/rpc"

Path is the HTTP/3 request path the agent dials on the existing QUIC connection to its tunnelproxy.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Code    string `json:"code"`
	Message string `json:"message,omitempty"`
}

Error carries a structured failure for a Request. Code is a stable short token (e.g. "unknown_command", "invalid_args", "busy", "deadline_exceeded"); Message is a human-readable detail.

type Request

type Request struct {
	Id      uint64          `json:"id"`
	Command string          `json:"command"`
	Args    json.RawMessage `json:"args,omitempty"`
}

Request is a single command invocation sent down to the agent.

type Response

type Response struct {
	Id     uint64          `json:"id"`
	Result json.RawMessage `json:"result,omitempty"`
	Error  *Error          `json:"error,omitempty"`
	Chunk  json.RawMessage `json:"chunk,omitempty"`
	Done   bool            `json:"done,omitempty"`
}

Response is one frame in the up direction. Exactly one of Result, Error, Chunk, or Done is set per frame.

Jump to

Keyboard shortcuts

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