# semrosin/dpisect architecture

> Architecture diagram of the GitHub repository semrosin/dpisect, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/semrosin/dpisect
- Repository: https://github.com/semrosin/dpisect

## Overview

DPIsect is an active network-probing research tool for investigating TLS/TCP failures, filtering triggers, and possible network interference. The primary workflow runs a configured experiment: optional DNS preflight, reproducible probe planning, controlled sending and packet capture, then offline classification of the saved capture. Separate tools support a controlled server and review of captured ClientHello trials, including browser traffic. The excerpts establish the main orchestration and several dependencies; other listed modules are included where their roles are supported by names or documented capabilities, but their internal links are omitted when not shown.

Main entry points: [`internal/runner/runner.go`](https://github.com/semrosin/dpisect/blob/main/internal/runner/runner.go) (Experiment runner), [`internal/runner/sni_wire_plan.go`](https://github.com/semrosin/dpisect/blob/main/internal/runner/sni_wire_plan.go) (SNI wire planning), [`cmd/dpi-analyze/main.go`](https://github.com/semrosin/dpisect/blob/main/cmd/dpi-analyze/main.go) (Analysis CLI), [`cmd/c01-review/main.go`](https://github.com/semrosin/dpisect/blob/main/cmd/c01-review/main.go) (Trial review CLI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experiment["Experiment execution"]
  node_prober["Probe CLI<br/>[main.go]"]
  node_runner["Experiment runner<br/>[runner.go]"]
  node_dns["DNS preflight<br/>[dnsprobe.go]"]
  node_plan["SNI wire planning<br/>[sni_wire_plan.go]"]
end

subgraph group_wire["Probe and capture"]
  node_generator["Probe generation<br/>[generator.go]"]
  node_sender["TLS and TCP sender<br/>[sender.go]"]
  node_capture["Live packet capture<br/>[live.go]"]
end

subgraph group_analysis["Offline analysis"]
  node_analyzecli["Analysis CLI<br/>[main.go]"]
  node_analyzer["Capture classifier<br/>[cause.go]"]
  node_tlsparse["TLS record parser<br/>[tlsparse.go]"]
  node_reviewcli["Trial review CLI<br/>[main.go]"]
  node_browserreview["Browser capture review<br/>[browser.go]"]
  node_reviewcapture["Trial capture inspection<br/>[capture.go]"]
end

subgraph group_server["Controlled server"]
  node_helpercli["Helper CLI<br/>[main.go]"]
  node_helper["Controlled TLS server<br/>[helper.go]"]
  node_lab["Network lab shaping<br/>[netem.go]"]
end

node_operator(("Research operator"))
node_network{{"Experiment network"}}

node_operator -->|"configures"| node_prober
node_prober -->|"runs"| node_runner
node_runner -->|"checks DNS"| node_dns
node_runner -->|"starts capture"| node_capture
node_runner -->|"sends probes"| node_sender
node_runner -->|"runs paired trials"| node_plan
node_plan -->|"builds packets"| node_generator
node_plan -->|"prepares TLS"| node_sender
node_sender -.->|"transmits probes"| node_network
node_network -.->|"provides traffic"| node_capture
node_operator -->|"starts server"| node_helpercli
node_helpercli -->|"serves connections"| node_helper
node_helpercli -->|"starts server capture"| node_capture
node_operator -->|"requests analysis"| node_analyzecli
node_analyzecli -->|"loads run config"| node_runner
node_analyzecli -->|"classifies capture"| node_analyzer
node_analyzer -->|"parses TLS"| node_tlsparse
node_operator -->|"reviews trial"| node_reviewcli
node_reviewcli -->|"inspects capture"| node_reviewcapture
node_reviewcli -->|"reviews browser flow"| node_browserreview
node_browserreview -->|"parses ClientHello"| node_tlsparse
node_operator -.->|"configures lab"| node_lab

click node_prober "https://github.com/semrosin/dpisect/blob/main/cmd/dpi-prober/main.go"
click node_runner "https://github.com/semrosin/dpisect/blob/main/internal/runner/runner.go"
click node_dns "https://github.com/semrosin/dpisect/blob/main/internal/dnsprobe/dnsprobe.go"
click node_plan "https://github.com/semrosin/dpisect/blob/main/internal/runner/sni_wire_plan.go"
click node_generator "https://github.com/semrosin/dpisect/blob/main/internal/generator/generator.go"
click node_sender "https://github.com/semrosin/dpisect/blob/main/internal/sender/sender.go"
click node_capture "https://github.com/semrosin/dpisect/blob/main/internal/capture/live.go"
click node_helpercli "https://github.com/semrosin/dpisect/blob/main/cmd/dpi-helper/main.go"
click node_helper "https://github.com/semrosin/dpisect/blob/main/internal/helper/helper.go"
click node_analyzecli "https://github.com/semrosin/dpisect/blob/main/cmd/dpi-analyze/main.go"
click node_analyzer "https://github.com/semrosin/dpisect/blob/main/internal/analyzer/cause.go"
click node_tlsparse "https://github.com/semrosin/dpisect/blob/main/internal/tlsparse/tlsparse.go"
click node_reviewcli "https://github.com/semrosin/dpisect/blob/main/cmd/c01-review/main.go"
click node_browserreview "https://github.com/semrosin/dpisect/blob/main/cmd/c01-review/browser.go"
click node_reviewcapture "https://github.com/semrosin/dpisect/blob/main/cmd/c01-review/capture.go"
click node_lab "https://github.com/semrosin/dpisect/blob/main/internal/lab/netem.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_prober,node_runner,node_dns,node_plan toneBlue
class node_generator,node_sender,node_capture toneAmber
class node_analyzecli,node_analyzer,node_tlsparse,node_reviewcli,node_browserreview,node_reviewcapture toneMint
class node_helpercli,node_helper,node_lab toneRose
class node_operator,node_network toneIndigo
```

## Components

### Experiment execution

- [Probe CLI](https://github.com/semrosin/dpisect/blob/main/cmd/dpi-prober/main.go): `cmd/dpi-prober/main.go`
- [Experiment runner](https://github.com/semrosin/dpisect/blob/main/internal/runner/runner.go): `internal/runner/runner.go`
- [DNS preflight](https://github.com/semrosin/dpisect/blob/main/internal/dnsprobe/dnsprobe.go): `internal/dnsprobe/dnsprobe.go`
- [SNI wire planning](https://github.com/semrosin/dpisect/blob/main/internal/runner/sni_wire_plan.go): `internal/runner/sni_wire_plan.go`

### Probe and capture

- [Probe generation](https://github.com/semrosin/dpisect/blob/main/internal/generator/generator.go): `internal/generator/generator.go`
- [TLS and TCP sender](https://github.com/semrosin/dpisect/blob/main/internal/sender/sender.go): `internal/sender/sender.go`
- [Live packet capture](https://github.com/semrosin/dpisect/blob/main/internal/capture/live.go): `internal/capture/live.go`

### Offline analysis

- [Analysis CLI](https://github.com/semrosin/dpisect/blob/main/cmd/dpi-analyze/main.go): `cmd/dpi-analyze/main.go`
- [Capture classifier](https://github.com/semrosin/dpisect/blob/main/internal/analyzer/cause.go): `internal/analyzer/cause.go`
- [TLS record parser](https://github.com/semrosin/dpisect/blob/main/internal/tlsparse/tlsparse.go): `internal/tlsparse/tlsparse.go`
- [Trial review CLI](https://github.com/semrosin/dpisect/blob/main/cmd/c01-review/main.go): `cmd/c01-review/main.go`
- [Browser capture review](https://github.com/semrosin/dpisect/blob/main/cmd/c01-review/browser.go): `cmd/c01-review/browser.go`
- [Trial capture inspection](https://github.com/semrosin/dpisect/blob/main/cmd/c01-review/capture.go): `cmd/c01-review/capture.go`

### Controlled server

- [Helper CLI](https://github.com/semrosin/dpisect/blob/main/cmd/dpi-helper/main.go): `cmd/dpi-helper/main.go`
- [Controlled TLS server](https://github.com/semrosin/dpisect/blob/main/internal/helper/helper.go): `internal/helper/helper.go`
- [Network lab shaping](https://github.com/semrosin/dpisect/blob/main/internal/lab/netem.go): `internal/lab/netem.go`

### Other components

- **Research operator**
- **Experiment network**

## Connections

- Research operator → Probe CLI: configures (evidence: `cmd/dpi-prober/main.go`)
- Probe CLI → Experiment runner: runs (evidence: `cmd/dpi-prober/main.go`)
- Experiment runner → DNS preflight: checks DNS (evidence: `internal/runner/runner.go`)
- Experiment runner → Live packet capture: starts capture (evidence: `internal/runner/runner.go`)
- Experiment runner → TLS and TCP sender: sends probes (evidence: `internal/runner/runner.go`)
- Experiment runner → SNI wire planning: runs paired trials (evidence: `internal/runner/runner.go`)
- SNI wire planning → Probe generation: builds packets (evidence: `internal/runner/sni_wire_plan.go`)
- SNI wire planning → TLS and TCP sender: prepares TLS (evidence: `internal/runner/sni_wire_plan.go`)
- TLS and TCP sender → Experiment network: transmits probes
- Experiment network → Live packet capture: provides traffic
- Research operator → Helper CLI: starts server (evidence: `cmd/dpi-helper/main.go`)
- Helper CLI → Controlled TLS server: serves connections (evidence: `cmd/dpi-helper/main.go`)
- Helper CLI → Live packet capture: starts server capture (evidence: `cmd/dpi-helper/main.go`)
- Research operator → Analysis CLI: requests analysis (evidence: `cmd/dpi-analyze/main.go`)
- Analysis CLI → Experiment runner: loads run config (evidence: `cmd/dpi-analyze/main.go`)
- Analysis CLI → Capture classifier: classifies capture (evidence: `cmd/dpi-analyze/main.go`)
- Capture classifier → TLS record parser: parses TLS (evidence: `internal/analyzer/cause.go`)
- Research operator → Trial review CLI: reviews trial (evidence: `cmd/c01-review/main.go`)
- Trial review CLI → Trial capture inspection: inspects capture (evidence: `cmd/c01-review/main.go`)
- Trial review CLI → Browser capture review: reviews browser flow (evidence: `cmd/c01-review/main.go`)
- Browser capture review → TLS record parser: parses ClientHello (evidence: `cmd/c01-review/browser.go`)
- Research operator → Network lab shaping: configures lab
