client

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: 15 Imported by: 0

Documentation

Overview

Package client is the Go client for pano's control API over the daemon's Unix socket (or loopback TCP). The CLI and the MCP server share it.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotRunning = errors.New("pano daemon is not running (start it with `pano start`)")

ErrNotRunning is returned when the daemon socket cannot be reached.

Functions

func FilterQuery

func FilterQuery(f api.FlowFilter) url.Values

FilterQuery encodes a filter as URL query parameters.

Types

type Client

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

Client talks to the daemon.

func New

func New(sock string) *Client

New returns a client for the Unix socket at path.

func NewTCP

func NewTCP(addr, token string) *Client

NewTCP returns a client for a loopback TCP address with a bearer token.

func (*Client) AddRule

func (c *Client) AddRule(ctx context.Context, req api.RuleAddRequest) (api.Rule, error)

AddRule creates a rule.

func (*Client) Attach

func (c *Client) Attach(ctx context.Context, own bool) (<-chan struct{}, error)

Attach registers this process as a terminal UI and keeps the connection open until ctx ends. The returned channel closes when the daemon closes the stream (it stopped, or was turned off elsewhere). With own, the daemon turns itself off once the connection drops (app mode).

func (*Client) Body

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

Body returns raw (or decoded) body bytes.

func (*Client) CAPEM

func (c *Client) CAPEM(ctx context.Context) ([]byte, error)

CAPEM fetches the root certificate.

func (*Client) Capture

func (c *Client) Capture(ctx context.Context, req api.CaptureRequest) (api.Status, error)

Capture controls recording.

func (*Client) ChangeDecrypt

func (c *Client) ChangeDecrypt(ctx context.Context, ch api.DecryptChange) (api.Decrypt, error)

ChangeDecrypt applies a partial update and returns the new policy.

func (*Client) Config

func (c *Client) Config(ctx context.Context) (json.RawMessage, error)

Config returns the live configuration.

func (*Client) Decrypt

func (c *Client) Decrypt(ctx context.Context) (api.Decrypt, error)

Decrypt returns the decrypt policy and recently rejected hosts.

func (*Client) DeleteSession

func (c *Client) DeleteSession(ctx context.Context, id string) error

DeleteSession removes a session and its flows.

func (*Client) Diff

func (c *Client) Diff(ctx context.Context, req api.DiffRequest) (api.DiffResult, error)

Diff compares flows.

func (*Client) Disown

func (c *Client) Disown(ctx context.Context) (api.Lifecycle, error)

Disown tells the daemon to keep running after the owning UI closes.

func (*Client) Events

func (c *Client) Events(ctx context.Context, types []string, host string) (<-chan flow.Event, error)

Events streams bus events until ctx is cancelled. The returned channel is closed on disconnect.

func (*Client) Explain

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

Explain digests LLM traffic.

func (*Client) Flow

func (c *Client) Flow(ctx context.Context, id flow.ID, q api.FlowQuery) (api.FlowDetail, error)

Flow returns a rendered flow.

func (*Client) FlowRaw

func (c *Client) FlowRaw(ctx context.Context, id flow.ID) (*flow.Flow, error)

FlowRaw returns the stored flow record.

func (*Client) Flows

func (c *Client) Flows(ctx context.Context, f api.FlowFilter) (api.FlowList, error)

Flows lists flows.

func (*Client) HAR

func (c *Client) HAR(ctx context.Context, req api.HARRequest) (api.HARResult, error)

HAR exports or imports.

func (*Client) Held

func (c *Client) Held(ctx context.Context) ([]api.Held, error)

Held lists held requests.

func (*Client) Mobile

func (c *Client) Mobile(ctx context.Context) (api.Mobile, error)

Mobile returns the LAN listener state and the devices seen.

func (*Client) Off

func (c *Client) Off(ctx context.Context) error

Off restores the system proxy and stops the daemon (`pano off`).

func (*Client) Ping

func (c *Client) Ping(ctx context.Context) bool

Ping reports whether the daemon answers.

func (*Client) Presets

func (c *Client) Presets(ctx context.Context) ([]api.Preset, error)

Presets lists rule presets.

func (*Client) RemoveAllRules

func (c *Client) RemoveAllRules(ctx context.Context) (int, error)

RemoveAllRules deletes every rule.

func (*Client) RemoveRule

func (c *Client) RemoveRule(ctx context.Context, id string) error

RemoveRule deletes a rule.

func (*Client) Replay

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

Replay re-sends a flow.

func (*Client) Resume

func (c *Client) Resume(ctx context.Context, id flow.ID, req api.ResumeRequest) error

Resume releases a held request.

func (*Client) Rules

func (c *Client) Rules(ctx context.Context) ([]api.Rule, error)

Rules lists rules.

func (*Client) Sessions

func (c *Client) Sessions(ctx context.Context) ([]api.Session, error)

Sessions lists sessions.

func (*Client) SetMobile

func (c *Client) SetMobile(ctx context.Context, req api.MobileRequest) (api.Mobile, error)

SetMobile opens or closes the proxy to the LAN.

func (*Client) SetSysProxy

func (c *Client) SetSysProxy(ctx context.Context, req api.SysProxyRequest) (api.SysProxy, error)

SetSysProxy toggles the system proxy.

func (*Client) Shutdown

func (c *Client) Shutdown(ctx context.Context) error

Shutdown asks the daemon to stop.

func (*Client) StartSession

func (c *Client) StartSession(ctx context.Context, name string) (api.Session, error)

StartSession begins a new named session.

func (*Client) Stats

func (c *Client) Stats(ctx context.Context) (api.Stats, error)

Stats returns counters.

func (*Client) Status

func (c *Client) Status(ctx context.Context) (api.Status, error)

Status returns daemon status.

func (*Client) SysProxy

func (c *Client) SysProxy(ctx context.Context) (api.SysProxy, error)

SysProxy returns system proxy state.

func (*Client) Tail

func (c *Client) Tail(ctx context.Context, req api.TailRequest) (api.TailResult, error)

Tail long-polls for new flows.

func (*Client) UpdateRule

func (c *Client) UpdateRule(ctx context.Context, id string, p api.RulePatch) (api.Rule, error)

UpdateRule patches a rule.

func (*Client) WSMessages

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

WSMessages returns captured WebSocket messages.

Jump to

Keyboard shortcuts

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