# alptekinsunnetci/netplotter architecture

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

- Interactive diagram: https://gitdiagram.com/alptekinsunnetci/netplotter
- Repository: https://github.com/alptekinsunnetci/netplotter

## Overview

rp is a real-time terminal network-path monitor. The user supplies one or more targets and probing options; the CLI resolves targets, runs periodic traceroutes, accumulates per-hop metrics, and presents live panels, with optional exports and comparison to an earlier JSON export. The README documents several capabilities whose implementation details are not fully sampled; the graph includes their supported modules and omits uncertain wiring. Main orchestration and core probe/metrics behavior are sampled; some subsystem links rely on README documentation.

Main entry points: [`cmd/rp/main.go`](https://github.com/alptekinsunnetci/netplotter/blob/main/cmd/rp/main.go) (Monitor runtime), [`internal/probe/factory.go`](https://github.com/alptekinsunnetci/netplotter/blob/main/internal/probe/factory.go) (Probe factory), [`internal/storage/storage.go`](https://github.com/alptekinsunnetci/netplotter/blob/main/internal/storage/storage.go) (Export backends), [`internal/diff/baseline.go`](https://github.com/alptekinsunnetci/netplotter/blob/main/internal/diff/baseline.go) (Diff baseline)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orchestration["CLI orchestration"]
  node_main["Monitor runtime<br/>[main.go]"]
  node_config["CLI configuration<br/>[config.go]"]
  node_baseline["Diff baseline<br/>[baseline.go]"]
end

subgraph group_discovery["Path discovery"]
  node_traceroute["Traceroute runner<br/>[traceroute.go]"]
  node_hop["Hop model<br/>[hop.go]"]
  node_probe["Probe factory<br/>[factory.go]"]
  node_icmp["ICMP probers<br/>[icmp.go]"]
  node_icmp6["ICMPv6 probers<br/>[icmp6.go]"]
  node_windowsicmp["Windows ICMP<br/>[icmp_windows.go]"]
  node_tcp["TCP prober<br/>[tcp.go]"]
end

subgraph group_measurement["Metrics enrichment"]
  node_session["Session metrics<br/>[session.go]"]
  node_hopmetrics["Per-hop statistics<br/>[hopmetrics.go]"]
  node_buffer["Sample buffer<br/>[buffer.go]"]
  node_dns["Reverse DNS cache<br/>[resolver.go]"]
end

subgraph group_outputs["Monitoring outputs"]
  node_renderer["Terminal renderer<br/>[terminal.go]"]
  node_storage["Export backends<br/>[storage.go]"]
  node_json["JSON export<br/>[json.go]"]
  node_csv["CSV export<br/>[csv.go]"]
  node_txt["Text export<br/>[txt.go]"]
end

node_user(("Operator"))
node_network(("Target network"))
node_dnsservice(("DNS service"))
node_terminal(("Terminal"))
node_exportfiles[("Export files")]
node_baselinefile["Prior JSON export"]

node_user -->|"starts monitor"| node_main
node_main -->|"parses options"| node_config
node_main -.->|"loads comparison"| node_baseline
node_baseline -.->|"reads JSON"| node_baselinefile
node_main -->|"creates prober"| node_probe
node_main -->|"runs routes"| node_traceroute
node_traceroute -->|"probes TTLs"| node_probe
node_probe -->|"selects ICMP"| node_icmp
node_probe -->|"selects ICMPv6"| node_icmp6
node_probe -->|"selects Windows"| node_windowsicmp
node_probe -->|"selects TCP"| node_tcp
node_icmp -->|"sends probes"| node_network
node_icmp6 -->|"sends probes"| node_network
node_windowsicmp -->|"sends probes"| node_network
node_tcp -->|"connects to target"| node_network
node_main -->|"records results"| node_session
node_session -->|"updates hop stats"| node_hopmetrics
node_hopmetrics -->|"stores samples"| node_buffer
node_main -->|"resolves hop names"| node_dns
node_dns -->|"looks up names"| node_dnsservice
node_main -->|"renders snapshots"| node_renderer
node_renderer -->|"draws panels"| node_terminal
node_terminal -->|"sends commands"| node_main
node_main -.->|"exports snapshots"| node_storage
node_storage -.->|"writes JSON"| node_json
node_storage -.->|"writes CSV"| node_csv
node_storage -.->|"writes text"| node_txt
node_json -.->|"writes export"| node_exportfiles
node_csv -.->|"writes export"| node_exportfiles
node_txt -.->|"writes export"| node_exportfiles

click node_main "https://github.com/alptekinsunnetci/netplotter/blob/main/cmd/rp/main.go"
click node_config "https://github.com/alptekinsunnetci/netplotter/blob/main/internal/config/config.go"
click node_baseline "https://github.com/alptekinsunnetci/netplotter/blob/main/internal/diff/baseline.go"
click node_traceroute "https://github.com/alptekinsunnetci/netplotter/blob/main/internal/traceroute/traceroute.go"
click node_hop "https://github.com/alptekinsunnetci/netplotter/blob/main/internal/traceroute/hop.go"
click node_probe "https://github.com/alptekinsunnetci/netplotter/blob/main/internal/probe/factory.go"
click node_icmp "https://github.com/alptekinsunnetci/netplotter/blob/main/internal/probe/icmp.go"
click node_icmp6 "https://github.com/alptekinsunnetci/netplotter/blob/main/internal/probe/icmp6.go"
click node_windowsicmp "https://github.com/alptekinsunnetci/netplotter/blob/main/internal/probe/icmp_windows.go"
click node_tcp "https://github.com/alptekinsunnetci/netplotter/blob/main/internal/probe/tcp.go"
click node_session "https://github.com/alptekinsunnetci/netplotter/blob/main/internal/metrics/session.go"
click node_hopmetrics "https://github.com/alptekinsunnetci/netplotter/blob/main/internal/metrics/hopmetrics.go"
click node_buffer "https://github.com/alptekinsunnetci/netplotter/blob/main/internal/metrics/buffer.go"
click node_dns "https://github.com/alptekinsunnetci/netplotter/blob/main/internal/dns/resolver.go"
click node_renderer "https://github.com/alptekinsunnetci/netplotter/blob/main/internal/renderer/terminal.go"
click node_storage "https://github.com/alptekinsunnetci/netplotter/blob/main/internal/storage/storage.go"
click node_json "https://github.com/alptekinsunnetci/netplotter/blob/main/internal/storage/json.go"
click node_csv "https://github.com/alptekinsunnetci/netplotter/blob/main/internal/storage/csv.go"
click node_txt "https://github.com/alptekinsunnetci/netplotter/blob/main/internal/storage/txt.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_main,node_config,node_baseline toneBlue
class node_traceroute,node_hop,node_probe,node_icmp,node_icmp6,node_windowsicmp,node_tcp,node_exportfiles toneAmber
class node_session,node_hopmetrics,node_buffer,node_dns toneMint
class node_renderer,node_storage,node_json,node_csv,node_txt toneRose
class node_user,node_network,node_dnsservice,node_terminal,node_baselinefile toneIndigo
```

## Components

### CLI orchestration

- [Monitor runtime](https://github.com/alptekinsunnetci/netplotter/blob/main/cmd/rp/main.go): `cmd/rp/main.go`
- [CLI configuration](https://github.com/alptekinsunnetci/netplotter/blob/main/internal/config/config.go): `internal/config/config.go`
- [Diff baseline](https://github.com/alptekinsunnetci/netplotter/blob/main/internal/diff/baseline.go): `internal/diff/baseline.go`

### Path discovery

- [Traceroute runner](https://github.com/alptekinsunnetci/netplotter/blob/main/internal/traceroute/traceroute.go): `internal/traceroute/traceroute.go`
- [Hop model](https://github.com/alptekinsunnetci/netplotter/blob/main/internal/traceroute/hop.go): `internal/traceroute/hop.go`
- [Probe factory](https://github.com/alptekinsunnetci/netplotter/blob/main/internal/probe/factory.go): `internal/probe/factory.go`
- [ICMP probers](https://github.com/alptekinsunnetci/netplotter/blob/main/internal/probe/icmp.go): `internal/probe/icmp.go`
- [ICMPv6 probers](https://github.com/alptekinsunnetci/netplotter/blob/main/internal/probe/icmp6.go): `internal/probe/icmp6.go`
- [Windows ICMP](https://github.com/alptekinsunnetci/netplotter/blob/main/internal/probe/icmp_windows.go): `internal/probe/icmp_windows.go`
- [TCP prober](https://github.com/alptekinsunnetci/netplotter/blob/main/internal/probe/tcp.go): `internal/probe/tcp.go`

### Metrics enrichment

- [Session metrics](https://github.com/alptekinsunnetci/netplotter/blob/main/internal/metrics/session.go): `internal/metrics/session.go`
- [Per-hop statistics](https://github.com/alptekinsunnetci/netplotter/blob/main/internal/metrics/hopmetrics.go): `internal/metrics/hopmetrics.go`
- [Sample buffer](https://github.com/alptekinsunnetci/netplotter/blob/main/internal/metrics/buffer.go): `internal/metrics/buffer.go`
- [Reverse DNS cache](https://github.com/alptekinsunnetci/netplotter/blob/main/internal/dns/resolver.go): `internal/dns/resolver.go`

### Monitoring outputs

- [Terminal renderer](https://github.com/alptekinsunnetci/netplotter/blob/main/internal/renderer/terminal.go): `internal/renderer/terminal.go`
- [Export backends](https://github.com/alptekinsunnetci/netplotter/blob/main/internal/storage/storage.go): `internal/storage/storage.go`
- [JSON export](https://github.com/alptekinsunnetci/netplotter/blob/main/internal/storage/json.go): `internal/storage/json.go`
- [CSV export](https://github.com/alptekinsunnetci/netplotter/blob/main/internal/storage/csv.go): `internal/storage/csv.go`
- [Text export](https://github.com/alptekinsunnetci/netplotter/blob/main/internal/storage/txt.go): `internal/storage/txt.go`

### Other components

- **Operator**
- **Target network**
- **DNS service**
- **Terminal**
- **Export files**
- **Prior JSON export**

## Connections

- Operator → Monitor runtime: starts monitor
- Monitor runtime → CLI configuration: parses options
- Monitor runtime → Diff baseline: loads comparison
- Diff baseline → Prior JSON export: reads JSON
- Monitor runtime → Probe factory: creates prober
- Monitor runtime → Traceroute runner: runs routes
- Traceroute runner → Probe factory: probes TTLs
- Probe factory → ICMP probers: selects ICMP
- Probe factory → ICMPv6 probers: selects ICMPv6
- Probe factory → Windows ICMP: selects Windows
- Probe factory → TCP prober: selects TCP
- ICMP probers → Target network: sends probes
- ICMPv6 probers → Target network: sends probes
- Windows ICMP → Target network: sends probes
- TCP prober → Target network: connects to target
- Monitor runtime → Session metrics: records results
- Session metrics → Per-hop statistics: updates hop stats
- Per-hop statistics → Sample buffer: stores samples
- Monitor runtime → Reverse DNS cache: resolves hop names
- Reverse DNS cache → DNS service: looks up names
- Monitor runtime → Terminal renderer: renders snapshots
- Terminal renderer → Terminal: draws panels
- Terminal → Monitor runtime: sends commands
- Monitor runtime → Export backends: exports snapshots
- Export backends → JSON export: writes JSON
- Export backends → CSV export: writes CSV
- Export backends → Text export: writes text
- JSON export → Export files: writes export
- CSV export → Export files: writes export
- Text export → Export files: writes export
