Documentation
¶
Overview ¶
Package web renders relayed traffic in a browser. It implements a relay.Reporter that accumulates transactions and streams them to connected pages over Server-Sent Events; the static front-end does JSON pretty-printing and folding client-side.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Body ¶
type Body struct {
Size int `json:"size"`
Text string `json:"text,omitempty"`
Base64 string `json:"base64,omitempty"`
Truncated bool `json:"truncated"`
}
Body is a body captured for display. Text is set for valid UTF-8 payloads; otherwise Base64 holds the raw bytes. Either way the content is capped at maxBodyBytes and Truncated records whether anything was dropped.
type Meta ¶
type Meta struct {
Addr string `json:"addr"`
Mode string `json:"mode"`
Namespace string `json:"namespace,omitempty"`
Proxy string `json:"proxy"`
Timeout string `json:"timeout"`
Version string `json:"version"`
AuthEnabled bool `json:"authEnabled"`
}
Meta is the relay configuration shown in the page header.
type Transaction ¶
type Transaction struct {
Seq uint64 `json:"seq"`
Namespace string `json:"namespace,omitempty"`
RewriteProfile string `json:"rewriteProfile,omitempty"`
At time.Time `json:"at"`
Method string `json:"method"`
Target string `json:"target"`
Status int `json:"status"`
DurationMs int64 `json:"durationMs"`
Bytes int64 `json:"bytes"`
Err string `json:"err,omitempty"`
ReqHead string `json:"reqHead,omitempty"`
ReqBody *Body `json:"reqBody,omitempty"`
RespHead string `json:"respHead,omitempty"`
RespBody *Body `json:"respBody,omitempty"`
HasReq bool `json:"hasReq"`
HasResp bool `json:"hasResp"`
Done bool `json:"done"`
}
Transaction accumulates everything known about one relayed request, keyed by seq. It mirrors the TUI's txn but is JSON-serializable for the browser.