Documentation
¶
Overview ¶
Package network provides the network-capture drivers. On simulator, mitmproxy is the canonical path: mav arranges CA trust and proxy configuration through `xcrun simctl`, then routes traffic through a background `mitmdump` instance that writes a HAR file. On physical device, MAV does not bundle a capture solution -- users point the device manually at a host-running proxy (documented in setup).
Index ¶
- Constants
- type MitmproxyDriver
- func (d *MitmproxyDriver) Cost(_ drivers.Capability, _ drivers.Target) int
- func (d *MitmproxyDriver) ID() string
- func (d *MitmproxyDriver) NetworkStart(ctx context.Context, target drivers.Target, spec drivers.NetworkCaptureSpec) (drivers.NetworkCaptureResult, error)
- func (d *MitmproxyDriver) NetworkStop(ctx context.Context, pid int) error
- func (d *MitmproxyDriver) Probe(_ context.Context, p drivers.Probe) drivers.HealthReport
- func (d *MitmproxyDriver) Provides(target drivers.Target) drivers.CapabilitySet
- func (d *MitmproxyDriver) Warm(_ context.Context, _ drivers.Target) <-chan error
Constants ¶
const ID = "mitmproxy"
ID is the registry key for the mitmproxy driver.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MitmproxyDriver ¶
type MitmproxyDriver struct {
// contains filtered or unexported fields
}
MitmproxyDriver wraps `mitmdump` for sim network capture.
func (*MitmproxyDriver) Cost ¶
func (d *MitmproxyDriver) Cost(_ drivers.Capability, _ drivers.Target) int
Cost is 0: mitmproxy is the only network-capture provider on sim.
func (*MitmproxyDriver) ID ¶
func (d *MitmproxyDriver) ID() string
func (*MitmproxyDriver) NetworkStart ¶
func (d *MitmproxyDriver) NetworkStart(ctx context.Context, target drivers.Target, spec drivers.NetworkCaptureSpec) (drivers.NetworkCaptureResult, error)
NetworkStart spawns mitmdump as a background process writing a HAR file.
The HAR output relies on mitmproxy's bundled `har_dump` addon (shipped since mitmproxy 10). Listen port defaults to 8080 when spec.ListenPort is zero; we additionally pick a free port on the loopback interface so parallel MAV runs don't clash.
CA trust and the simulator's proxy plist are NOT touched here -- the `mav setup` flow handles those once per machine. NetworkStart assumes trust is already established; otherwise mitmdump still records but HTTPS traffic shows as CONNECT-tunnel only.
func (*MitmproxyDriver) NetworkStop ¶
func (d *MitmproxyDriver) NetworkStop(ctx context.Context, pid int) error
NetworkStop sends a clean shutdown to mitmdump (SIGTERM via the platform's process model). The caller is responsible for waiting on the HAR file to flush -- mitmdump writes it incrementally so the file is valid even if interrupted.
func (*MitmproxyDriver) Probe ¶
func (d *MitmproxyDriver) Probe(_ context.Context, p drivers.Probe) drivers.HealthReport
Probe checks mitmdump is on PATH.
func (*MitmproxyDriver) Provides ¶
func (d *MitmproxyDriver) Provides(target drivers.Target) drivers.CapabilitySet
Provides advertises CapNetworkCapture only on simulator targets. Device users are expected to point traffic at an externally-running proxy -- MAV does not bundle that flow.