control

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: MIT Imports: 34 Imported by: 0

Documentation

Overview

Package control serves the Interceptor UI and the REST + SSE control API on the fixed localhost control port. It bridges the browser UI to the store and the intercept engine and pushes live events (captured flows, hold-queue changes) over Server-Sent Events.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hub

type Hub struct {

	// Upstream applies a chained upstream-proxy URL ("" = direct). Set by cmd.
	Upstream func(string) error

	// ChecksDir holds user-authored Starlark scanner checks ("" = none). Set by cmd.
	ChecksDir string

	// SelfAddr is this control plane's own host:port (e.g. 127.0.0.1:9966). Set by
	// cmd; the active scanner refuses to target it, so it never attacks its own API.
	SelfAddr string
	// contains filtered or unexported fields
}

Hub is the control-plane HTTP handler and live-event broadcaster. It also implements the proxy's Events sink (FlowCaptured).

func New

func New(st *store.Store, eng *intercept.Engine, ca *tlsca.CA, rebind Rebinder, sc *scope.Engine) *Hub

New builds a Hub. eng, ca, and rebind may be nil. If eng is non-nil, the hub registers itself as the intercept change notifier.

func (*Hub) FlowCaptured

func (h *Hub) FlowCaptured(f *store.Flow)

FlowCaptured implements proxy.Events: it pushes a captured flow to all live UI subscribers. Safe for concurrent use.

func (*Hub) Handler

func (h *Hub) Handler() http.Handler

Handler returns the control-plane HTTP handler, wrapped in the loopback/CSRF security guard (see securityGuard).

func (*Hub) WSFramed

func (h *Hub) WSFramed(flowID int64)

WSFramed implements the proxy's optional ws-frame sink: it nudges the UI to refresh the frame list for a websocket flow.

type Rebinder

type Rebinder interface {
	Rebind(addr string) error // open the new listener first; keep the old one on failure
	Addr() string             // the current proxy listen address
}

Rebinder lets the control plane move the proxy listener at runtime.

Jump to

Keyboard shortcuts

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