This directory specifies each module with concrete Swift interfaces. Design the types and signatures exactly as written here before implementing bodies; if you must change a contract, change the spec in the same commit.
Shared (framework, linked into both targets)
├── Models value types: FlowKey, FlowRecord, PacketMeta, headers, enums → data-model.md
├── Persistence GRDB store (FlowStore actor), schema, migrations → persistence.md
├── Audit audit projects, sessions, markers, allowlist, findings → audit.md
├── DNS DNS message dissector, address → name map → packet-parsing.md
├── Capture streaming pcap writer (moved here in M11) → pcap.md
├── Plaintext decrypted-content writer, format and per-flow budget → plaintext.md
└── IPC ring buffer + Darwin signal + control-channel codec → ipc.md
PacketTunnel (NEPacketTunnelProvider extension)
├── PacketTunnelProvider lifecycle, network settings, read/write loop → tunnel-provider.md
├── Pipeline the hot path minus packetFlow (pure, testable) → tunnel-provider.md
├── IP IPv4/IPv6/TCP/UDP parsing → packet-parsing.md
├── Flow FlowTable + TCPReassembler → flow-and-reassembly.md
├── Relay outbound NWConnection relay + passthrough → relay-and-tls.md
└── TLS local CA, leaf minting, opt-in termination → relay-and-tls.md
TunnelVision (app)
├── Services tunnel control (M9), live feed reader, history reader → app-services.md
└── ViewModels/Views screens, charts, inspector → ../ux/
Shared depends on nothing but Apple frameworks + GRDB. PacketTunnel and TunnelVision
depend on Shared, never on each other. The two processes only ever meet at the App Group
container (SQLite + ring buffer).
TunnelVision(app) ─┐ ┌─ PacketTunnel(ext)
├─▶ Shared ◀──────────────┤
└─ reads DB + ring ◀──── writes DB + ring
| Component | Isolation |
|---|---|
| Packet read loop | extension’s provider, async loop |
FlowTable, TCPReassembler |
actor (serialized) |
PcapWriter |
actor (serialized file I/O) |
FlowStore (GRDB write) |
actor; GRDB uses its own writer queue underneath |
| Ring buffer producer | called from the read loop; lock-free SPSC |
| Ring buffer consumer | app side, background task; lock-free SPSC |
| View models | @MainActor |
Data + protocol family from packetFlowFlowKey + PacketMeta (pure, packet-parsing.md)FlowTable; if TCP and inspected, feed TCPReassembler (flow-and-reassembly.md)relay-and-tls.md)PacketMeta to ring buffer (live) and, batched, to FlowStore (durable)PcapWriter (pcap.md)Everything on this path is bounded and allocation-frugal; see the memory rules in
../development/02-coding-standards.md.