network

package
v0.16.5 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 5 Imported by: 0

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

View Source
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 New

func New(exec drivers.Executor) *MitmproxyDriver

New constructs a Driver.

func (*MitmproxyDriver) Cost

Cost is 0: mitmproxy is the only network-capture provider on sim.

func (*MitmproxyDriver) ID

func (d *MitmproxyDriver) ID() string

func (*MitmproxyDriver) NetworkStart

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

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.

func (*MitmproxyDriver) Warm

func (d *MitmproxyDriver) Warm(_ context.Context, _ drivers.Target) <-chan error

Warm has no async work.

Jump to

Keyboard shortcuts

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