daemon

package
v0.1.1 Latest Latest
Warning

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

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

Documentation

Overview

Package daemon is pano's composition root: it wires the certificate authority, the proxy engine, capture storage, the rules engine, the system-proxy manager and the control/MCP servers together, and implements the control API backend on top of them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, opts Options) error

Run starts the daemon and blocks until ctx is cancelled or Shutdown is called.

Types

type Daemon

type Daemon struct {
	// contains filtered or unexported fields
}

Daemon owns every long-lived component.

func (*Daemon) AddRule

func (d *Daemon) AddRule(_ context.Context, req api.RuleAddRequest) (api.Rule, error)

AddRule implements control.Backend.

func (*Daemon) Attach

func (d *Daemon) Attach(own bool) func()

Attach implements control.Backend.

func (*Daemon) Audit

func (d *Daemon) Audit(line string)

Audit appends a line to the audit log.

func (*Daemon) Blob

func (d *Daemon) Blob(b []byte) string

Blob implements proxy.Sink.

func (*Daemon) Body

func (d *Daemon) Body(ctx context.Context, id flow.ID, part string, decode bool) ([]byte, string, error)

Body implements control.Backend.

func (*Daemon) Bus

func (d *Daemon) Bus() *bus.Bus

Bus implements control.Backend.

func (*Daemon) CAPEM

func (d *Daemon) CAPEM(context.Context) []byte

CAPEM implements control.Backend.

func (*Daemon) Capture

func (d *Daemon) Capture(ctx context.Context, req api.CaptureRequest) (api.Status, error)

Capture implements control.Backend.

func (*Daemon) ChangeDecrypt

func (d *Daemon) ChangeDecrypt(ctx context.Context, c api.DecryptChange) (api.Decrypt, error)

ChangeDecrypt implements control.Backend: validates and applies a partial update, persists [decrypt] to config.toml, and returns the new state.

func (*Daemon) Config

func (d *Daemon) Config(context.Context) any

Config implements control.Backend.

func (*Daemon) Decrypt

func (d *Daemon) Decrypt(context.Context) api.Decrypt

Decrypt implements control.Backend.

func (*Daemon) DeleteSession

func (d *Daemon) DeleteSession(_ context.Context, id string) error

DeleteSession implements control.Backend: forgets the session and every flow captured under it.

func (*Daemon) Diff

func (d *Daemon) Diff(ctx context.Context, req api.DiffRequest) (api.DiffResult, error)

Diff implements control.Backend.

func (*Daemon) Disown

func (d *Daemon) Disown(context.Context)

Disown implements control.Backend.

func (*Daemon) Done

func (d *Daemon) Done(f *flow.Flow)

Done implements proxy.Sink.

func (*Daemon) Explain

func (d *Daemon) Explain(ctx context.Context, id flow.ID, req api.ExplainRequest) (api.ExplainResult, error)

Explain implements control.Backend.

func (*Daemon) GetFlow

func (d *Daemon) GetFlow(ctx context.Context, id flow.ID, q api.FlowQuery) (api.FlowDetail, error)

GetFlow implements control.Backend.

func (*Daemon) GetFlowRaw

func (d *Daemon) GetFlowRaw(ctx context.Context, id flow.ID) (*flow.Flow, error)

GetFlowRaw implements control.Backend.

func (*Daemon) HAR

func (d *Daemon) HAR(ctx context.Context, req api.HARRequest) (api.HARResult, error)

HAR implements control.Backend.

func (*Daemon) Held

func (d *Daemon) Held(context.Context) []api.Held

Held implements control.Backend.

func (*Daemon) Lifecycle

func (d *Daemon) Lifecycle() api.Lifecycle

Lifecycle reports the current mode for status surfaces.

func (*Daemon) ListFlows

func (d *Daemon) ListFlows(ctx context.Context, f api.FlowFilter) (api.FlowList, error)

ListFlows implements control.Backend.

func (*Daemon) Mobile

func (d *Daemon) Mobile(context.Context) api.Mobile

Mobile implements control.Backend: the LAN listener state plus every remote device the proxy has seen.

func (*Daemon) Off

func (d *Daemon) Off(ctx context.Context) error

Off implements control.Backend: restore the system proxy, then stop. Closing the proxy listeners on shutdown takes the mobile listener down with them.

func (*Daemon) Presets

func (d *Daemon) Presets(context.Context) []api.Preset

Presets implements control.Backend.

func (*Daemon) RemoveAllRules

func (d *Daemon) RemoveAllRules(context.Context) int

RemoveAllRules implements control.Backend.

func (*Daemon) RemoveRule

func (d *Daemon) RemoveRule(_ context.Context, id string) error

RemoveRule implements control.Backend.

func (*Daemon) Replay

func (d *Daemon) Replay(ctx context.Context, id flow.ID, req api.ReplayRequest) (api.ReplayResult, error)

Replay implements control.Backend. The request is sent through the proxy itself so it is captured and rules apply.

func (*Daemon) Resume

func (d *Daemon) Resume(_ context.Context, id flow.ID, req api.ResumeRequest) error

Resume implements control.Backend.

func (*Daemon) Rules

func (d *Daemon) Rules(context.Context) []api.Rule

Rules implements control.Backend.

func (*Daemon) Sessions

func (d *Daemon) Sessions(context.Context) ([]api.Session, error)

Sessions implements control.Backend.

func (*Daemon) SetMobile

func (d *Daemon) SetMobile(_ context.Context, req api.MobileRequest) (api.Mobile, error)

SetMobile implements control.Backend. Enabling binds one more proxy listener on the Mac's LAN address (never 0.0.0.0, never the control API or MCP), admitting private-network clients only. Disabling closes it; open tunnels finish on their own.

func (*Daemon) SetSysProxy

func (d *Daemon) SetSysProxy(ctx context.Context, req api.SysProxyRequest) (api.SysProxy, error)

SetSysProxy implements control.Backend.

func (*Daemon) Shutdown

func (d *Daemon) Shutdown(context.Context) error

Shutdown implements control.Backend.

func (*Daemon) StartSession

func (d *Daemon) StartSession(_ context.Context, name string) (api.Session, error)

StartSession implements control.Backend.

func (*Daemon) Started

func (d *Daemon) Started(f *flow.Flow)

Started implements proxy.Sink.

func (*Daemon) Stats

func (d *Daemon) Stats(context.Context) api.Stats

Stats implements control.Backend.

func (*Daemon) Status

func (d *Daemon) Status(ctx context.Context) api.Status

Status implements control.Backend.

func (*Daemon) SysProxy

func (d *Daemon) SysProxy(ctx context.Context) api.SysProxy

SysProxy implements control.Backend.

func (*Daemon) Tail

func (d *Daemon) Tail(ctx context.Context, req api.TailRequest) (api.TailResult, error)

Tail implements control.Backend: returns flows completed after the cursor, waiting up to WaitMS for the first one.

func (*Daemon) UpdateRule

func (d *Daemon) UpdateRule(_ context.Context, id string, p api.RulePatch) (api.Rule, error)

UpdateRule implements control.Backend.

func (*Daemon) Updated

func (d *Daemon) Updated(f *flow.Flow)

Updated implements proxy.Sink.

func (*Daemon) WS

func (d *Daemon) WS(m *flow.WSMessage)

WS implements proxy.Sink.

func (*Daemon) WSMessages

func (d *Daemon) WSMessages(ctx context.Context, id flow.ID, limit int) ([]flow.WSMessage, error)

WSMessages implements control.Backend.

type Options

type Options struct {
	Paths   config.Paths
	Config  config.Config
	Version string
	Port    int // overrides
	MCPPort int
	Bind    string
	Logger  *slog.Logger
}

Options configure Run.

Jump to

Keyboard shortcuts

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