Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ProxyServer ¶
type ProxyServer struct {
Addr string
Mode ProxyMode
CAManager *ca.CAManager
Handler RequestHandler
InjectHeaders map[string]string // headers to inject into outgoing requests
MaxBodySize int64 // max response body size in bytes (0 = unlimited)
// contains filtered or unexported fields
}
ProxyServer is an HTTP/HTTPS forward proxy.
func NewProxyServer ¶
func NewProxyServer(addr string, mode ProxyMode, cam *ca.CAManager, handler RequestHandler) *ProxyServer
NewProxyServer creates a ProxyServer ready to be started.
type RecordHandler ¶
type RecordHandler struct {
HashComputer *hash.HashComputer
SnapshotStore *snapshot.SnapshotStore
EnvExpander *envvar.Expander // optional, collapses URLs to {{VAR}} placeholders
Redactor *redact.Redactor // optional, scrubs PII/secrets before saving
}
RecordHandler handles intercepted request/response pairs in record mode by computing a request hash and persisting the response as a snapshot.
func NewRecordHandler ¶
func NewRecordHandler(hc *hash.HashComputer, ss *snapshot.SnapshotStore) *RecordHandler
NewRecordHandler creates a RecordHandler with the given hash computer and snapshot store.
func (*RecordHandler) HandleRequest ¶
HandleRequest computes a deterministic hash from the request, reads the response body, and persists the snapshot entry keyed by host and hash.
type RequestHandler ¶
RequestHandler processes intercepted request/response pairs.
type TestHandler ¶
type TestHandler struct {
HashComputer *hash.HashComputer
SnapshotStore *snapshot.SnapshotStore
DiffEngine *diff.DiffEngine
ApprovalManager *approval.ApprovalManager
EnvExpander *envvar.Expander // optional, collapses URLs before hashing
Summary *snapshot.TestSummary
HitHashes []string // hashes that were matched during this test run
// contains filtered or unexported fields
}
TestHandler handles intercepted request/response pairs in test mode by comparing live responses against stored snapshots and tracking results.
func NewTestHandler ¶
func NewTestHandler(hc *hash.HashComputer, ss *snapshot.SnapshotStore, de *diff.DiffEngine, am *approval.ApprovalManager) *TestHandler
NewTestHandler creates a TestHandler wired to the given components.
func (*TestHandler) GetHitHashes ¶
func (h *TestHandler) GetHitHashes() []string
GetHitHashes returns the list of snapshot hashes that were matched.
func (*TestHandler) GetSummary ¶
func (h *TestHandler) GetSummary() snapshot.TestSummary
GetSummary returns a copy of the current test summary.
func (*TestHandler) HandleRequest ¶
HandleRequest computes the request hash, looks up the stored snapshot, and compares the live response against it. Counters are updated thread-safely.