Documentation
¶
Overview ¶
Package capture records, as faithfully as possible, what a real client sends to a local fake upstream.
The ground truth is the raw bytes of every accepted TCP connection: a tee below net/http writes everything read from the client to raw/conn-N.in and (optionally) everything written back to raw/conn-N.out. Nothing is parsed, canonicalized, redacted or re-ordered in those files, so header-name casing, header order, duplicate headers, the request line, chunked framing and the exact body bytes survive. index.jsonl only locates each request inside them.
See .design/vmodel-capture.md.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
// Out also records the bytes written back to the client
// (raw/conn-N.out). Callers normally want this on.
Out bool
// RequestID makes the capture handler add a `request-id` response header
// (req_vmodel_<seq>) to responses that do not set one.
RequestID bool
// Warn receives one-line diagnostics (an unwritable capture file, a
// credential that does not look fake). It must not be nil.
Warn func(string)
}
Options configure a Tap.
type Tap ¶
type Tap struct {
// contains filtered or unexported fields
}
Tap owns one capture directory.
func New ¶
New prepares dir for capture. The directory must not exist or must be empty: a capture is evidence, so it is never mixed with or written over another.
func (*Tap) Handler ¶
Handler wraps next. It must be the outermost handler so every request is seen before routing or body binding, including ones next rejects. It never reads the request body and never changes what next sees or answers (apart from the opt-in request-id header).
func (*Tap) Install ¶
Install hooks srv so each request can be located in its connection's raw files. It chains any ConnContext / ConnState already set.