Documentation
¶
Index ¶
Constants ¶
const ( FrameTypeRequest = "request" FrameTypeStream = "stream" FrameTypeAgentInfo = "agent_info" FrameTypePing = "ping" FrameTypePong = "pong" )
FrameType indicates the kind of tunnel message.
Variables ¶
This section is empty.
Functions ¶
func DecodeFrameHeader ¶
DecodeFrameHeader decodes only the JSON header and returns the payload offset.
func EncodeFrame ¶
EncodeFrame encodes a JSON header and binary payload into a single binary message.
Types ¶
type IncomingHeader ¶
IncomingHeader is used for initial JSON unmarshaling to determine frame type.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry tracks active WebSocket tunnels keyed by sandbox ID.
type RequestHeader ¶
type RequestHeader struct {
Type string `json:"type"`
ID string `json:"id"`
Method string `json:"method"`
Path string `json:"path"`
Headers map[string]string `json:"headers"`
}
RequestHeader is the JSON metadata for a request frame (server → agent).
type StreamHeader ¶
type StreamHeader struct {
Type string `json:"type"`
ID string `json:"id"`
Status int `json:"status,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
Done bool `json:"done"`
}
StreamHeader is the JSON metadata for a stream frame (agent → server).
type StreamMessage ¶
type StreamMessage struct {
Header StreamHeader
Payload []byte
}
StreamMessage holds a decoded stream frame header and its binary payload.
type Tunnel ¶
type Tunnel struct {
SandboxID string
Conn *websocket.Conn
OnAgentInfo func(data json.RawMessage)
// contains filtered or unexported fields
}
Tunnel represents an active WebSocket tunnel to a local agent.
func (*Tunnel) CleanupRequest ¶
CleanupRequest removes a pending waiter after the request is done.
func (*Tunnel) Done ¶
func (t *Tunnel) Done() <-chan struct{}
Done returns a channel that is closed when the tunnel shuts down.
func (*Tunnel) SendRequest ¶
func (t *Tunnel) SendRequest(ctx context.Context, header *RequestHeader, body []byte) (<-chan *StreamMessage, error)
SendRequest sends a request frame through the tunnel and returns a channel for receiving streamed response messages.