Documentation
¶
Overview ¶
Package proxy sits between a local client and one upstream service, forwards the exchange untouched, and hands a copy to the recorder.
Forwarding fidelity comes first. Sonda is a debugger: if it alters what the upstream receives or what the client sees, every conclusion drawn from it is worthless. Capture is a side effect of the copy, never a step in it.
Index ¶
Constants ¶
const FaultHeader = "X-Sonda-Fault"
FaultHeader marks an answer Sonda broke on purpose. Same role as the stub header: a client that cannot tell an injected failure from a real one would chase the wrong bug, and this is the one place the distinction reaches code that is not looking at Sonda's interface.
const ReplayHeader = "X-Sonda-Replay-Of"
ReplayHeader marks a request Sonda is sending on the operator's behalf. The proxy strips it before forwarding, so the upstream receives exactly the original request and the captured headers do not gain a field the real client never sent — the replay is recorded as a link, not as a difference in the traffic.
const StubHeader = "X-Sonda-Stub"
StubHeader goes on every answer that came from a recording rather than from the service. A client that cannot tell the two apart is the failure mode this whole feature has to avoid, and a header is the one place the distinction reaches code that is not looking at Sonda's interface.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Faults ¶ added in v0.9.0
Faults is the part of the fault registry a proxy needs. Nil never injects anything, which is what every proxy does until told otherwise.
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
func (*Proxy) Handler ¶
Handler is what the listener serves: the proxy itself for HTTP targets, and an h2c-capable wrapper for gRPC ones.
func (*Proxy) ServeAMQP ¶ added in v0.16.0
ServeAMQP forwards one AMQP 0-9-1 connection byte-for-byte and records useful units while the connection remains open.
One RabbitMQ connection commonly lives for hours and multiplexes many channels. Waiting for it to close would make a publish invisible while it is being debugged, and one row per frame would split a method from its content. The taps therefore emit standalone methods immediately and group each content-bearing method with its following header and body frames per channel.
func (*Proxy) ServePostgres ¶ added in v0.11.0
ServePostgres forwards one client connection to the upstream database and records a capture per statement while it runs.
type Recorder ¶
Recorder is the sink for captured calls. It is an interface so the proxy can be tested without a database.
type Stubs ¶ added in v0.6.0
type Stubs interface {
On(target string) bool
Match(ctx context.Context, target, method, path string, body []byte) (*store.Call, error)
}
Stubs is the part of the stub registry a proxy needs. Nil means this proxy always forwards, which is what every proxy does until someone says otherwise.