proxy

package
v0.17.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2026 License: Apache-2.0, Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidRootCA is returned when the root CA PEM file does not
	// contain both a certificate and a matching RSA private key.
	ErrInvalidRootCA = errors.New("proxy: invalid root CA file")
	// ErrCircuitOpen is returned by cbTransport.RoundTrip when the
	// per-host circuit breaker is open for the target host.
	ErrCircuitOpen = errors.New("proxy: circuit open")
)

Sentinel errors. Kept at package level per repo conventions.

Functions

func NewTestHandler

func NewTestHandler(rec func(model.Event) error, pol CapturePolicy) http.Handler

Expose an http.Handler for tests without starting a server.

Types

type CapturePolicy

type CapturePolicy struct {
	AllowedRequestHeaders  []string
	AllowedResponseHeaders []string
	CaptureBodyValues      bool
	CaptureBodies          bool
	MaxBodyBytes           int64
	SampleRate             float64
	WSMaxFrames            int      // default 0
	RedactJSONFields       []string // JSON fields to mark as redacted (supports dot.paths for nested)
	RedactHeaders          []string // header names whose values should be treated as redacted (names still listed)
	HashJSONFields         []string // JSON fields to hash (SHA-256 hex truncated) instead of full value; applied after redaction
	HashHeaders            []string // Header names whose values should be hashed (per request/response) and stored in Event.Hashed with key header:<Name>
}

type Mode

type Mode int
const (
	ModePassthrough Mode = iota
	ModeInspect
)

type Proxy

type Proxy interface {
	Run(ctx context.Context, addr string, mode Mode, pol CapturePolicy, tls TLSConfig) error
}

func New

func New() Proxy

func NewWith

func NewWith(rec func(model.Event) error, dec grpcdecode.Decoder) Proxy

func NewWithRecorder

func NewWithRecorder(rec func(model.Event) error) Proxy

type TLSConfig

type TLSConfig struct {
	EnableMITM bool
	RootCAPath string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL