# leeeeeeedw/cfdata-web architecture

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

- Interactive diagram: https://gitdiagram.com/leeeeeeedw/cfdata-web
- Repository: https://github.com/leeeeeeedw/cfdata-web

## Overview

CFData-Web is a Go Cloudflare IP scanning, filtering, and speed-testing tool with Web and CLI entry points. The Web workflow is driven by browser WebSocket actions through task management into official or custom-target scans, optional detailed tests and speed tests, then result display/export; CLI runs comparable modes and supports GitHub uploads. The README also documents IPv4 subnet compaction and cache reset. Edges reflect README relationships or shown call sites; several unexcerpted CLI and service internals are represented only at their documented subsystem paths.

Main entry points: [`combined_refactor/tasks_official.go`](https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/tasks_official.go) (Official IP scan), [`combined_refactor/cli.go`](https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/cli.go) (CLI mode), [`combined_refactor/tasks_nsb.go`](https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/tasks_nsb.go) (Custom target testing), [`combined_refactor/server.go`](https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/server.go) (WebSocket commands)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Interfaces"]
  node_webapp["Web interface<br/>[index.html]"]
  node_cli["CLI mode<br/>[cli.go]"]
  node_webserver["HTTP and WS server<br/>[main.go]"]
  node_auth["Web authentication<br/>[auth.go]"]
  node_wsrouter["WebSocket commands<br/>[server.go]"]
  node_websocket["WebSocket transport<br/>[server.go]"]
end

subgraph group_runtime["Task runtime"]
  node_taskcontrol["Task control<br/>[session.go]"]
  node_workerpool["Bounded workers<br/>[tasks_common.go]"]
  node_resultstore[("Session results<br/>[types.go]")]
end

subgraph group_workflows["Testing workflows"]
  node_officialscan["Official IP scan<br/>[tasks_official.go]"]
  node_detailedtest["Detailed testing<br/>[tasks_official.go]"]
  node_speedtests["Speed testing<br/>[tasks_speed.go]"]
  node_customscan["Custom target testing<br/>[tasks_nsb.go]"]
  node_compaction["IPv4 compaction<br/>[tasks_compact.go]"]
end

subgraph group_data["Data and integrations"]
  node_cachedata[("IP and location cache<br/>[storage.go]")]
  node_export["CSV and TXT export<br/>[cli.go]"]
  node_uploader["GitHub upload<br/>[server.go]"]
  node_cacheadmin["Cache reset<br/>[storage.go]"]
  node_dns["Custom DNS<br/>[dns.go]"]
end

node_browser(("Browser user"))
node_terminal(("CLI user"))
node_network(("Cloudflare targets"))
node_speedendpoint(("Speed-test endpoint"))
node_github(("GitHub repository"))

node_browser -->|"uses"| node_webapp
node_terminal -->|"runs"| node_cli
node_webapp -->|"connects"| node_webserver
node_webserver -->|"routes login"| node_auth
node_webserver -->|"routes WS"| node_wsrouter
node_wsrouter -->|"starts tasks"| node_taskcontrol
node_taskcontrol -->|"runs"| node_officialscan
node_taskcontrol -->|"runs"| node_customscan
node_taskcontrol -.->|"runs"| node_compaction
node_officialscan -->|"loads IP list"| node_cachedata
node_officialscan -.->|"dispatches"| node_workerpool
node_officialscan -->|"probes"| node_network
node_officialscan -->|"enables selection"| node_detailedtest
node_detailedtest -->|"offers retest"| node_speedtests
node_detailedtest -.->|"stores results"| node_resultstore
node_customscan -->|"tests targets"| node_network
node_customscan -->|"runs optional"| node_speedtests
node_customscan -->|"writes results"| node_export
node_speedtests -->|"downloads from"| node_speedendpoint
node_compaction -->|"replaces IPv4 list"| node_cachedata
node_cli -.->|"runs mode"| node_officialscan
node_cli -.->|"runs mode"| node_customscan
node_cli -->|"configures output"| node_export
node_cli -.->|"can upload"| node_uploader
node_wsrouter -->|"handles upload"| node_uploader
node_uploader -->|"writes content"| node_github
node_wsrouter -->|"handles reset"| node_cacheadmin
node_cacheadmin -->|"deletes cache"| node_cachedata
node_cachedata -.->|"uses resolver"| node_dns

click node_webapp "https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/index.html"
click node_cli "https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/cli.go"
click node_webserver "https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/main.go"
click node_auth "https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/auth.go"
click node_wsrouter "https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/server.go"
click node_taskcontrol "https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/session.go"
click node_officialscan "https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/tasks_official.go"
click node_detailedtest "https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/tasks_official.go"
click node_speedtests "https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/tasks_speed.go"
click node_customscan "https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/tasks_nsb.go"
click node_compaction "https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/tasks_compact.go"
click node_workerpool "https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/tasks_common.go"
click node_resultstore "https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/types.go"
click node_websocket "https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/server.go"
click node_cachedata "https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/storage.go"
click node_export "https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/cli.go"
click node_uploader "https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/server.go"
click node_cacheadmin "https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/storage.go"
click node_dns "https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/dns.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_webapp,node_cli,node_webserver,node_auth,node_wsrouter,node_websocket,node_browser,node_terminal toneBlue
class node_taskcontrol,node_workerpool,node_resultstore toneAmber
class node_officialscan,node_detailedtest,node_speedtests,node_customscan,node_compaction toneMint
class node_cachedata,node_export,node_uploader,node_cacheadmin,node_dns toneRose
class node_network,node_speedendpoint,node_github toneIndigo
```

## Components

### Interfaces

- [Web interface](https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/index.html): `combined_refactor/index.html`
- [CLI mode](https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/cli.go): `combined_refactor/cli.go`
- [HTTP and WS server](https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/main.go): `combined_refactor/main.go`
- [Web authentication](https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/auth.go): `combined_refactor/auth.go`
- [WebSocket commands](https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/server.go): `combined_refactor/server.go`
- [WebSocket transport](https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/server.go): `combined_refactor/server.go`

### Task runtime

- [Task control](https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/session.go): `combined_refactor/session.go`
- [Bounded workers](https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/tasks_common.go): `combined_refactor/tasks_common.go`
- [Session results](https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/types.go): `combined_refactor/types.go`

### Testing workflows

- [Official IP scan](https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/tasks_official.go): `combined_refactor/tasks_official.go`
- [Detailed testing](https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/tasks_official.go): `combined_refactor/tasks_official.go`
- [Speed testing](https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/tasks_speed.go): `combined_refactor/tasks_speed.go`
- [Custom target testing](https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/tasks_nsb.go): `combined_refactor/tasks_nsb.go`
- [IPv4 compaction](https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/tasks_compact.go): `combined_refactor/tasks_compact.go`

### Data and integrations

- [IP and location cache](https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/storage.go): `combined_refactor/storage.go`
- [CSV and TXT export](https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/cli.go): `combined_refactor/cli.go`
- [GitHub upload](https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/server.go): `combined_refactor/server.go`
- [Cache reset](https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/storage.go): `combined_refactor/storage.go`
- [Custom DNS](https://github.com/leeeeeeedw/cfdata-web/blob/main/combined_refactor/dns.go): `combined_refactor/dns.go`

### Other components

- **Browser user**
- **CLI user**
- **Cloudflare targets**
- **Speed-test endpoint**
- **GitHub repository**

## Connections

- Browser user → Web interface: uses (evidence: `README.md`)
- CLI user → CLI mode: runs (evidence: `README.md`)
- Web interface → HTTP and WS server: connects (evidence: `README.md`)
- HTTP and WS server → Web authentication: routes login (evidence: `combined_refactor/main.go`)
- HTTP and WS server → WebSocket commands: routes WS (evidence: `combined_refactor/main.go`)
- WebSocket commands → Task control: starts tasks (evidence: `combined_refactor/server.go`)
- Task control → Official IP scan: runs
- Task control → Custom target testing: runs
- Task control → IPv4 compaction: runs (evidence: `README.md`)
- Official IP scan → IP and location cache: loads IP list (evidence: `combined_refactor/tasks_official.go`)
- Official IP scan → Bounded workers: dispatches (evidence: `combined_refactor/tasks_common.go`)
- Official IP scan → Cloudflare targets: probes (evidence: `combined_refactor/tasks_official.go`)
- Official IP scan → Detailed testing: enables selection (evidence: `README.md`)
- Detailed testing → Speed testing: offers retest (evidence: `README.md`)
- Detailed testing → Session results: stores results
- Custom target testing → Cloudflare targets: tests targets (evidence: `combined_refactor/tasks_nsb.go`)
- Custom target testing → Speed testing: runs optional (evidence: `combined_refactor/tasks_nsb.go`)
- Custom target testing → CSV and TXT export: writes results (evidence: `README.md`)
- Speed testing → Speed-test endpoint: downloads from (evidence: `combined_refactor/tasks_speed.go`)
- IPv4 compaction → IP and location cache: replaces IPv4 list (evidence: `combined_refactor/tasks_compact.go`)
- CLI mode → Official IP scan: runs mode (evidence: `README.md`)
- CLI mode → Custom target testing: runs mode (evidence: `README.md`)
- CLI mode → CSV and TXT export: configures output (evidence: `README.md`)
- CLI mode → GitHub upload: can upload (evidence: `README.md`)
- WebSocket commands → GitHub upload: handles upload (evidence: `combined_refactor/server.go`)
- GitHub upload → GitHub repository: writes content (evidence: `combined_refactor/server.go`)
- WebSocket commands → Cache reset: handles reset (evidence: `combined_refactor/storage.go`)
- Cache reset → IP and location cache: deletes cache (evidence: `combined_refactor/storage.go`)
- IP and location cache → Custom DNS: uses resolver
