proxy

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Proxy

type Proxy struct {

	// SslInsecure skips TLS verification for upstream servers.
	SslInsecure bool

	// HostFilter controls which hosts are intercepted vs tunneled.
	HostFilter *hostfilter.HostFilter

	// ScriptEngine is optional; enables request/response rewriting via JS scripts.
	ScriptEngine *scripting.Engine

	// ThrottleBPS is initial bandwidth limit in bytes/sec (0 = unlimited).
	ThrottleBPS int64

	// ThrottleLatency is initial per-response latency to add.
	ThrottleLatency time.Duration

	// BreakpointCtrl is optional; enables script breakpoints.
	BreakpointCtrl breakpoint.Controller

	// Resolver is optional; resolves process info for connections.
	Resolver *procinfo.Resolver
	// contains filtered or unexported fields
}

Proxy wraps go-mitmproxy and captures traffic into a RingBuffer.

func New

func New(s *store.RingBuffer, dataDir string) *Proxy

New creates a Proxy that writes captured flows into the given store. dataDir is the base data directory (CA certs stored under dataDir/).

func (*Proxy) Addr

func (p *Proxy) Addr() string

Addr returns the listen address passed to Init.

func (*Proxy) CACertPath

func (p *Proxy) CACertPath() string

CACertPath returns the path to the CA certificate file for user trust.

func (*Proxy) GetThrottleBPS added in v0.1.5

func (p *Proxy) GetThrottleBPS() int64

GetThrottleBPS returns current bandwidth limit.

func (*Proxy) GetThrottleLatency added in v0.1.5

func (p *Proxy) GetThrottleLatency() time.Duration

GetThrottleLatency returns current latency setting.

func (*Proxy) Init

func (p *Proxy) Init(addr string) error

Init sets up the MITM proxy (CA generation + port validation). This must be called before Serve. addr is e.g. ":8080".

func (*Proxy) Serve

func (p *Proxy) Serve(ctx context.Context) error

Serve starts the proxy accept loop. Blocks until ctx is cancelled or error.

func (*Proxy) SetThrottle added in v0.1.5

func (p *Proxy) SetThrottle(bps int64, latency time.Duration)

SetThrottle updates throttle settings at runtime.

func (*Proxy) Stop

func (p *Proxy) Stop()

Stop gracefully shuts down the proxy.

Jump to

Keyboard shortcuts

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