Documentation
¶
Overview ¶
Package flow defines the capture data model: a Flow is one HTTP exchange, WebSocket session, or opaque tunnel seen by the proxy, plus the events the engine publishes as a flow progresses.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BodyRef ¶
type BodyRef struct {
Hash string `json:"hash,omitempty"`
Size int64 `json:"size"`
Captured int64 `json:"captured"`
Truncated bool `json:"truncated,omitempty"`
Encoding string `json:"encoding,omitempty"`
MIME string `json:"mime,omitempty"`
}
BodyRef describes a captured body stored in the blob store.
type Event ¶
type Event struct {
Type EventType `json:"type"`
Seq uint64 `json:"seq"`
TS time.Time `json:"ts"`
Flow *Flow `json:"flow,omitempty"`
Phase string `json:"phase,omitempty"`
WS *WSMessage `json:"ws,omitempty"`
Dropped int `json:"dropped,omitempty"`
}
Event is what the engine publishes on the bus.
type EventType ¶
type EventType string
EventType enumerates bus events.
const ( EvStarted EventType = "started" // Flow set (request headers known) EvHeaders EventType = "headers" // Flow set (response headers known) EvDone EventType = "done" // Flow set (final) EvHeld EventType = "held" // Flow set; Phase set EvWS EventType = "ws" // WS set EvDropped EventType = "dropped" // Dropped set )
Event types.
type Flow ¶
type Flow struct {
ID ID `json:"id"`
Session string `json:"session"`
Kind Kind `json:"kind"`
Client string `json:"client"`
Proto string `json:"proto,omitempty"`
UpProto string `json:"up_proto,omitempty"`
Scheme string `json:"scheme"`
Host string `json:"host"`
Port int `json:"port"`
Method string `json:"method,omitempty"`
Path string `json:"path,omitempty"`
Query string `json:"query,omitempty"`
ReqHeaders http.Header `json:"req_headers,omitempty"`
ReqBody BodyRef `json:"req_body"`
Status int `json:"status,omitempty"`
RespHeaders http.Header `json:"resp_headers,omitempty"`
RespBody BodyRef `json:"resp_body"`
Trailers http.Header `json:"trailers,omitempty"`
T Timing `json:"timing"`
Error string `json:"error,omitempty"`
Tags []string `json:"tags,omitempty"`
Rules []RuleHit `json:"rules,omitempty"`
State State `json:"state"`
Replay bool `json:"replay,omitempty"`
ReplayOf ID `json:"replay_of,omitempty"`
}
Flow is one captured exchange. Once State is Done/Failed it is immutable.
type ID ¶
type ID uint64
ID is a monotonic flow identifier.
func ParseShort ¶
ParseShort inverts Short. It accepts upper case and the Crockford confusables (i/l → 1, o → 0).
type IDGen ¶
type IDGen struct {
// contains filtered or unexported fields
}
IDGen hands out monotonic IDs.
type RuleHit ¶
type RuleHit struct {
RuleID string `json:"rule_id"`
Name string `json:"name,omitempty"`
Phase string `json:"phase"`
Action string `json:"action"`
Note string `json:"note,omitempty"`
}
RuleHit records that a rule acted on the flow.
type Timing ¶
type Timing struct {
Start time.Time `json:"start"`
DNSDone time.Time `json:"dns_done,omitempty"`
Connected time.Time `json:"connected,omitempty"`
TLSDone time.Time `json:"tls_done,omitempty"`
WroteReq time.Time `json:"wrote_req,omitempty"`
FirstByte time.Time `json:"first_byte,omitempty"`
HeadersSent time.Time `json:"headers_sent,omitempty"`
End time.Time `json:"end,omitempty"`
Reused bool `json:"reused,omitempty"`
}
Timing records the phases of an exchange.
type WSMessage ¶
type WSMessage struct {
FlowID ID `json:"flow_id"`
Seq int `json:"seq"`
TS time.Time `json:"ts"`
Dir string `json:"dir"` // "c2s" | "s2c"
Opcode int `json:"opcode"`
Len int64 `json:"len"`
Payload []byte `json:"payload,omitempty"`
Masked bool `json:"masked,omitempty"`
}
WSMessage is one captured WebSocket frame/message.