Documentation
¶
Index ¶
- Constants
- func TypeName(t uint32) string
- func WriteFrame(w io.Writer, f *Frame) error
- func WriteTraceFrame(w io.Writer, tf *TraceFrame) error
- type Client
- func (c *Client) Close() error
- func (c *Client) Recv() (*Frame, error)
- func (c *Client) SendBinary(data []byte) error
- func (c *Client) SendFile(name string, data []byte) error
- func (c *Client) SendJSON(data []byte) error
- func (c *Client) SendText(text string) error
- func (c *Client) SendTrace(innerType uint32, data []byte) (sentAtNs int64, err error)
- type Frame
- type Handler
- type Server
- type TraceFrame
Constants ¶
const ( TypeText uint32 = 1 TypeBinary uint32 = 2 TypeJSON uint32 = 3 TypeFile uint32 = 4 // TypeTrace wraps another frame type with nanosecond-precision timing. // Wire layout: [4-byte TypeTrace][4-byte len][4-byte inner_type][8-byte sent_at_ns][inner_payload] TypeTrace uint32 = 5 )
Frame types for data exchange on port 1001.
const MaxFrameSize = 1 << 28
MaxFrameSize caps a single data-exchange frame at 256 MiB. Sized to fit the test fleet's 100 MiB file payloads with margin while still rejecting pathological 500 MiB+ frames that would dominate memory.
Variables ¶
This section is empty.
Functions ¶
func WriteFrame ¶
WriteFrame writes a frame to a writer.
func WriteTraceFrame ¶
func WriteTraceFrame(w io.Writer, tf *TraceFrame) error
WriteTraceFrame serialises a TraceFrame as a TypeTrace outer frame.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client connects to a remote data exchange service on port 1001.
func (*Client) SendBinary ¶
SendBinary sends a binary frame.
type Frame ¶
Frame is a typed data unit exchanged between agents. Wire format: [4-byte type][4-byte length][payload] For TypeFile, payload is: [2-byte name length][name bytes][file data]
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server listens on port 1001 and dispatches incoming frames to a handler.
func (*Server) ListenAndServe ¶
ListenAndServe binds port 1001 and starts accepting connections.
type TraceFrame ¶
TraceFrame carries timing metadata around an inner message frame.
func ReadTracePayload ¶
func ReadTracePayload(f *Frame) (*TraceFrame, error)
ReadTracePayload decodes a TraceFrame from a raw TypeTrace Frame.