# tworjaga/netcheck architecture

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

- Interactive diagram: https://gitdiagram.com/tworjaga/netcheck
- Repository: https://github.com/tworjaga/netcheck

## Overview

netcheck is a command-line network diagnostic and monitoring tool. A user enters through the CLI or its interactive menu, runs targeted checks or the consolidated doctor workflow, and receives ranked findings, advice, live events, or reports. Its capabilities span local-network inventory and risk monitoring, connectivity and performance, DNS and domain/mail/website audits, server reachability, and remote-agent uptime monitoring. Source evidence is sampled unevenly; documented capability links are retained, while unverified implementation links are omitted.

Main entry points: [`internal/cli`](https://github.com/tworjaga/netcheck/tree/main/internal/cli) (Commands and menu), [`internal/probe`](https://github.com/tworjaga/netcheck/tree/main/internal/probe) (Network probes), [`internal/domain`](https://github.com/tworjaga/netcheck/tree/main/internal/domain) (Domain and mail audits), [`internal/uptime/uptime.go`](https://github.com/tworjaga/netcheck/blob/main/internal/uptime/uptime.go) (Uptime checks)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI experience"]
  node_cli["Commands and menu"]
  node_doctor["Doctor summary<br/>[cmd_doctor.go]"]
  node_ui["Terminal UI"]
end

subgraph group_checks["Network checks"]
  node_probe["Network probes"]
  node_trace["Route tracing<br/>[trace.go]"]
  node_port["Port diagnosis<br/>[port.go]"]
  node_perf["Link performance<br/>[perf.go]"]
end

subgraph group_audits["Domain audits"]
  node_lan_audit["LAN risk audit<br/>[lanaudit.go]"]
  node_dns["DNS operations"]
  node_domain["Domain and mail audits"]
  node_web["Website and certificate audits<br/>[site.go]"]
  node_rdap["Ownership lookup<br/>[rdap.go]"]
end

subgraph group_monitoring["Monitoring"]
  node_lan_watch["LAN change watch<br/>[lanwatch.go]"]
  node_uptime_cli["Uptime command<br/>[cmd_uptime.go]"]
  node_uptime["Uptime checks<br/>[uptime.go]"]
  node_history[("Uptime history<br/>[history.go]")]
  node_alerts["Alert delivery<br/>[alert.go]"]
end

subgraph group_remote["Remote agents"]
  node_agent_cli["Agent command<br/>[cmd_agent.go]"]
  node_agent["Remote agent service<br/>[agent.go]"]
end

node_user(("User"))
node_network(("Local and public networks"))
node_internet(("Remote hosts and services"))

node_user -->|"runs checks"| node_cli
node_cli -->|"runs summary"| node_doctor
node_cli -->|"shows menu"| node_ui
node_doctor -->|"runs probes"| node_probe
node_doctor -->|"renders findings"| node_ui
node_cli -->|"runs route trace"| node_trace
node_cli -->|"diagnoses ports"| node_port
node_cli -->|"measures performance"| node_perf
node_cli -->|"audits LAN"| node_lan_audit
node_cli -->|"watches LAN"| node_lan_watch
node_cli -->|"runs DNS tools"| node_dns
node_cli -->|"audits domains"| node_domain
node_cli -->|"audits websites"| node_web
node_cli -->|"looks up ownership"| node_rdap
node_lan_audit -->|"uses probes"| node_probe
node_lan_audit -->|"grades findings"| node_domain
node_lan_watch -->|"samples network"| node_probe
node_domain -->|"queries DNS"| node_dns
node_web -->|"builds checks"| node_domain
node_uptime_cli -->|"runs monitoring"| node_uptime
node_uptime -->|"checks targets"| node_probe
node_uptime_cli -->|"reads history"| node_history
node_uptime_cli -->|"sends alerts"| node_alerts
node_agent_cli -->|"controls agent"| node_agent
node_agent_cli -->|"watches targets"| node_uptime
node_agent_cli -->|"sends alerts"| node_alerts
node_network -.->|"answers probes"| node_probe
node_internet -.->|"returns hops"| node_trace
node_internet -.->|"answers checks"| node_uptime

click node_cli "https://github.com/tworjaga/netcheck/tree/main/internal/cli"
click node_doctor "https://github.com/tworjaga/netcheck/blob/main/internal/cli/cmd_doctor.go"
click node_ui "https://github.com/tworjaga/netcheck/tree/main/internal/ui"
click node_probe "https://github.com/tworjaga/netcheck/tree/main/internal/probe"
click node_trace "https://github.com/tworjaga/netcheck/blob/main/internal/tracex/trace.go"
click node_port "https://github.com/tworjaga/netcheck/blob/main/internal/portx/port.go"
click node_perf "https://github.com/tworjaga/netcheck/blob/main/internal/perf/perf.go"
click node_lan_audit "https://github.com/tworjaga/netcheck/blob/main/internal/lanaudit/lanaudit.go"
click node_lan_watch "https://github.com/tworjaga/netcheck/blob/main/internal/lanwatch/lanwatch.go"
click node_dns "https://github.com/tworjaga/netcheck/tree/main/internal/dnsx"
click node_domain "https://github.com/tworjaga/netcheck/tree/main/internal/domain"
click node_web "https://github.com/tworjaga/netcheck/blob/main/internal/webx/site.go"
click node_rdap "https://github.com/tworjaga/netcheck/blob/main/internal/rdap/rdap.go"
click node_uptime_cli "https://github.com/tworjaga/netcheck/blob/main/internal/cli/cmd_uptime.go"
click node_uptime "https://github.com/tworjaga/netcheck/blob/main/internal/uptime/uptime.go"
click node_history "https://github.com/tworjaga/netcheck/blob/main/internal/uptime/history.go"
click node_agent_cli "https://github.com/tworjaga/netcheck/blob/main/internal/cli/cmd_agent.go"
click node_agent "https://github.com/tworjaga/netcheck/blob/main/internal/agent/agent.go"
click node_alerts "https://github.com/tworjaga/netcheck/blob/main/internal/alert/alert.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_cli,node_doctor,node_ui,node_user toneBlue
class node_probe,node_trace,node_port,node_perf toneAmber
class node_lan_audit,node_dns,node_domain,node_web,node_rdap toneMint
class node_lan_watch,node_uptime_cli,node_uptime,node_history,node_alerts toneRose
class node_agent_cli,node_agent,node_network,node_internet toneIndigo
```

## Components

### CLI experience

- [Commands and menu](https://github.com/tworjaga/netcheck/tree/main/internal/cli): `internal/cli`
- [Doctor summary](https://github.com/tworjaga/netcheck/blob/main/internal/cli/cmd_doctor.go): `internal/cli/cmd_doctor.go`
- [Terminal UI](https://github.com/tworjaga/netcheck/tree/main/internal/ui): `internal/ui`

### Network checks

- [Network probes](https://github.com/tworjaga/netcheck/tree/main/internal/probe): `internal/probe`
- [Route tracing](https://github.com/tworjaga/netcheck/blob/main/internal/tracex/trace.go): `internal/tracex/trace.go`
- [Port diagnosis](https://github.com/tworjaga/netcheck/blob/main/internal/portx/port.go): `internal/portx/port.go`
- [Link performance](https://github.com/tworjaga/netcheck/blob/main/internal/perf/perf.go): `internal/perf/perf.go`

### Domain audits

- [LAN risk audit](https://github.com/tworjaga/netcheck/blob/main/internal/lanaudit/lanaudit.go): `internal/lanaudit/lanaudit.go`
- [DNS operations](https://github.com/tworjaga/netcheck/tree/main/internal/dnsx): `internal/dnsx`
- [Domain and mail audits](https://github.com/tworjaga/netcheck/tree/main/internal/domain): `internal/domain`
- [Website and certificate audits](https://github.com/tworjaga/netcheck/blob/main/internal/webx/site.go): `internal/webx/site.go`
- [Ownership lookup](https://github.com/tworjaga/netcheck/blob/main/internal/rdap/rdap.go): `internal/rdap/rdap.go`

### Monitoring

- [LAN change watch](https://github.com/tworjaga/netcheck/blob/main/internal/lanwatch/lanwatch.go): `internal/lanwatch/lanwatch.go`
- [Uptime command](https://github.com/tworjaga/netcheck/blob/main/internal/cli/cmd_uptime.go): `internal/cli/cmd_uptime.go`
- [Uptime checks](https://github.com/tworjaga/netcheck/blob/main/internal/uptime/uptime.go): `internal/uptime/uptime.go`
- [Uptime history](https://github.com/tworjaga/netcheck/blob/main/internal/uptime/history.go): `internal/uptime/history.go`
- [Alert delivery](https://github.com/tworjaga/netcheck/blob/main/internal/alert/alert.go): `internal/alert/alert.go`

### Remote agents

- [Agent command](https://github.com/tworjaga/netcheck/blob/main/internal/cli/cmd_agent.go): `internal/cli/cmd_agent.go`
- [Remote agent service](https://github.com/tworjaga/netcheck/blob/main/internal/agent/agent.go): `internal/agent/agent.go`

### Other components

- **User**
- **Local and public networks**
- **Remote hosts and services**

## Connections

- User → Commands and menu: runs checks (evidence: `README.md`)
- Commands and menu → Doctor summary: runs summary (evidence: `README.md`)
- Commands and menu → Terminal UI: shows menu (evidence: `README.md`)
- Doctor summary → Network probes: runs probes (evidence: `internal/cli/cmd_doctor.go`)
- Doctor summary → Terminal UI: renders findings (evidence: `internal/cli/cmd_doctor.go`)
- Commands and menu → Route tracing: runs route trace (evidence: `README.md`)
- Commands and menu → Port diagnosis: diagnoses ports (evidence: `README.md`)
- Commands and menu → Link performance: measures performance (evidence: `README.md`)
- Commands and menu → LAN risk audit: audits LAN (evidence: `README.md`)
- Commands and menu → LAN change watch: watches LAN (evidence: `README.md`)
- Commands and menu → DNS operations: runs DNS tools (evidence: `README.md`)
- Commands and menu → Domain and mail audits: audits domains (evidence: `README.md`)
- Commands and menu → Website and certificate audits: audits websites (evidence: `README.md`)
- Commands and menu → Ownership lookup: looks up ownership (evidence: `README.md`)
- LAN risk audit → Network probes: uses probes (evidence: `internal/lanaudit/lanaudit.go`)
- LAN risk audit → Domain and mail audits: grades findings (evidence: `internal/lanaudit/lanaudit.go`)
- LAN change watch → Network probes: samples network (evidence: `internal/lanwatch/lanwatch.go`)
- Domain and mail audits → DNS operations: queries DNS (evidence: `internal/domain/mail.go`)
- Website and certificate audits → Domain and mail audits: builds checks (evidence: `internal/webx/site.go`)
- Uptime command → Uptime checks: runs monitoring (evidence: `internal/cli/cmd_uptime.go`)
- Uptime checks → Network probes: checks targets (evidence: `internal/uptime/uptime.go`)
- Uptime command → Uptime history: reads history (evidence: `internal/cli/cmd_uptime.go`)
- Uptime command → Alert delivery: sends alerts (evidence: `internal/cli/cmd_uptime.go`)
- Agent command → Remote agent service: controls agent (evidence: `internal/cli/cmd_agent.go`)
- Agent command → Uptime checks: watches targets (evidence: `internal/cli/cmd_agent.go`)
- Agent command → Alert delivery: sends alerts (evidence: `internal/cli/cmd_agent.go`)
- Local and public networks → Network probes: answers probes
- Remote hosts and services → Route tracing: returns hops
- Remote hosts and services → Uptime checks: answers checks
