proxy

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package proxy implements an intercepting HTTP/HTTPS forward proxy that captures every flow. Plain HTTP is forwarded directly; HTTPS is intercepted via CONNECT + a locally-minted leaf certificate (TLS MITM).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Events

type Events interface {
	FlowCaptured(*store.Flow) // a new flow (request seen / sent upstream)
	FlowUpdated(*store.Flow)  // an existing flow filled in (response, error, …)
}

Events is an optional sink notified when a flow is captured (used by the control plane to push live updates to the UI).

type ScopeChecker

type ScopeChecker interface {
	InScope(*store.Flow) bool
}

ScopeChecker reports whether a flow is in the engagement's target scope. When set, only in-scope requests are held by the intercept gate.

type Server

type Server struct {
	Scope ScopeChecker // nil → everything in scope

	// SelfPorts are this tool's own loopback ports (control plane + proxy). Set
	// by cmd; traffic to them is forwarded but never recorded, so proxying
	// localhost doesn't fill history with — or feedback-loop on — our own UI.
	SelfPorts []int
	// contains filtered or unexported fields
}

Server is the intercepting forward-proxy HTTP handler.

func New

func New(st *store.Store, cap *capture.Capturer, ca *tlsca.CA, eng *intercept.Engine, events Events) *Server

New builds a proxy Server. ca, eng, and events may each be nil.

func (*Server) Serve

func (s *Server) Serve(ln net.Listener) error

Serve accepts connections on ln until it is closed.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP dispatches: CONNECT → TLS MITM; absolute-URI → HTTP forward proxy.

func (*Server) SetCaptureScopeOnly added in v0.5.0

func (s *Server) SetCaptureScopeOnly(v bool)

SetCaptureScopeOnly switches between persisting all traffic (false) and only in-scope traffic (true) — a space optimization for long engagements. With no scope rules defined everything is in scope, so this becomes a no-op until the operator sets a target scope.

func (*Server) SetInvisibleProxy added in v0.23.0

func (s *Server) SetInvisibleProxy(v bool)

SetInvisibleProxy toggles transparent/invisible proxy mode (Burp's "Support invisible proxying"). When enabled, origin-form requests from clients that aren't proxy-configured (traffic redirected via iptables/pf/DNS/port forwarding) are forwarded to the host named in their Host header, instead of being rejected as malformed proxy requests. Absolute-URI and CONNECT requests keep working unchanged.

func (*Server) SetSuppressBrowserTelemetry added in v0.7.0

func (s *Server) SetSuppressBrowserTelemetry(v bool)

SetSuppressBrowserTelemetry controls whether known Chrome and Firefox background telemetry, update, and crash-reporting hosts are silently forwarded without being captured or held by the intercept gate. Enabled by default; users may turn it off to inspect browser background traffic.

func (*Server) SetUpstreamProxy

func (s *Server) SetUpstreamProxy(raw string) error

SetUpstreamProxy routes outbound traffic through a chained proxy (e.g. a corporate proxy). An empty string means connect directly.

Jump to

Keyboard shortcuts

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