# echoping07/downonly architecture

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

- Interactive diagram: https://gitdiagram.com/echoping07/downonly
- Repository: https://github.com/echoping07/downonly

## Overview

DownOnly is a lightweight traffic-management service with a browser-based control panel. Its main workflow is to accept configuration from the WebUI, schedule and select public download sources, transfer data without writing it to disk, and expose status and historical traffic/log data. The README documents scheduling, source testing and recovery, security controls, auditing, and persistence; the sampled Go excerpts show initialization, configuration loading, download-loop behavior, and HTTP handlers. Most behavior is implemented in main.go, so several distinct responsibilities share that path.

Main entry points: [`main.go`](https://github.com/echoping07/downonly/blob/main/main.go) (HTTP API), [`index.html`](https://github.com/echoping07/downonly/blob/main/index.html) (WebUI), [`priority_linux.go`](https://github.com/echoping07/downonly/blob/main/priority_linux.go) (Process Priority)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Web Interface"]
  node_webui["WebUI<br/>[index.html]"]
  node_httpapi["HTTP API<br/>[main.go]"]
end

subgraph group_control["Control and Scheduling"]
  node_appinit["App Initialization<br/>[main.go]"]
  node_config["Configuration<br/>[main.go]"]
  node_scheduler["Schedule and Quota<br/>[main.go]"]
  node_sourcepool["Source Selection<br/>[main.go]"]
  node_priority["Process Priority<br/>[priority_linux.go]"]
end

subgraph group_transfer["Download and Safety"]
  node_downloader["Download Worker<br/>[main.go]"]
  node_urlguard["URL Safety Checks<br/>[main.go]"]
  node_discard["Discarded Data<br/>[main.go]"]
end

subgraph group_audit["Audit and Persistence"]
  node_liveaudit["Live Monitoring<br/>[main.go]"]
  node_stats[("Traffic History<br/>[main.go]")]
  node_logs[("Daily Logs<br/>[main.go]")]
end

node_browser(("Browser User"))
node_remote{{"Download Sources"}}

node_browser -->|"opens"| node_webui
node_webui -->|"calls"| node_httpapi
node_httpapi -->|"reads and updates"| node_config
node_httpapi -->|"returns status"| node_liveaudit
node_httpapi -->|"returns history"| node_stats
node_httpapi -->|"returns entries"| node_logs
node_httpapi -->|"tests URLs"| node_urlguard
node_httpapi -->|"restores source"| node_sourcepool
node_appinit -->|"loads and saves"| node_config
node_appinit -->|"restores running state"| node_scheduler
node_scheduler -->|"selects sources"| node_sourcepool
node_scheduler -->|"starts downloads"| node_downloader
node_downloader -->|"validates URL"| node_urlguard
node_downloader -->|"downloads from"| node_remote
node_downloader -->|"discards bytes"| node_discard
node_downloader -->|"records rate"| node_liveaudit
node_liveaudit -->|"updates totals"| node_stats
node_liveaudit -->|"records events"| node_logs
node_appinit -->|"sets low priority"| node_priority

click node_webui "https://github.com/echoping07/downonly/blob/main/index.html"
click node_httpapi "https://github.com/echoping07/downonly/blob/main/main.go"
click node_appinit "https://github.com/echoping07/downonly/blob/main/main.go"
click node_config "https://github.com/echoping07/downonly/blob/main/main.go"
click node_scheduler "https://github.com/echoping07/downonly/blob/main/main.go"
click node_sourcepool "https://github.com/echoping07/downonly/blob/main/main.go"
click node_downloader "https://github.com/echoping07/downonly/blob/main/main.go"
click node_urlguard "https://github.com/echoping07/downonly/blob/main/main.go"
click node_discard "https://github.com/echoping07/downonly/blob/main/main.go"
click node_liveaudit "https://github.com/echoping07/downonly/blob/main/main.go"
click node_stats "https://github.com/echoping07/downonly/blob/main/main.go"
click node_logs "https://github.com/echoping07/downonly/blob/main/main.go"
click node_priority "https://github.com/echoping07/downonly/blob/main/priority_linux.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_webui,node_httpapi,node_browser toneBlue
class node_appinit,node_config,node_scheduler,node_sourcepool,node_priority toneAmber
class node_downloader,node_urlguard,node_discard toneMint
class node_liveaudit,node_stats,node_logs toneRose
class node_remote toneIndigo
```

## Components

### Web Interface

- [WebUI](https://github.com/echoping07/downonly/blob/main/index.html): `index.html`
- [HTTP API](https://github.com/echoping07/downonly/blob/main/main.go): `main.go`

### Control and Scheduling

- [App Initialization](https://github.com/echoping07/downonly/blob/main/main.go): `main.go`
- [Configuration](https://github.com/echoping07/downonly/blob/main/main.go): `main.go`
- [Schedule and Quota](https://github.com/echoping07/downonly/blob/main/main.go): `main.go`
- [Source Selection](https://github.com/echoping07/downonly/blob/main/main.go): `main.go`
- [Process Priority](https://github.com/echoping07/downonly/blob/main/priority_linux.go): `priority_linux.go`

### Download and Safety

- [Download Worker](https://github.com/echoping07/downonly/blob/main/main.go): `main.go`
- [URL Safety Checks](https://github.com/echoping07/downonly/blob/main/main.go): `main.go`
- [Discarded Data](https://github.com/echoping07/downonly/blob/main/main.go): `main.go`

### Audit and Persistence

- [Live Monitoring](https://github.com/echoping07/downonly/blob/main/main.go): `main.go`
- [Traffic History](https://github.com/echoping07/downonly/blob/main/main.go): `main.go`
- [Daily Logs](https://github.com/echoping07/downonly/blob/main/main.go): `main.go`

### Other components

- **Browser User**
- **Download Sources**

## Connections

- Browser User → WebUI: opens (evidence: `README.md`)
- WebUI → HTTP API: calls (evidence: `README.md`)
- HTTP API → Configuration: reads and updates (evidence: `README.md`)
- HTTP API → Live Monitoring: returns status (evidence: `README.md`)
- HTTP API → Traffic History: returns history (evidence: `README.md`)
- HTTP API → Daily Logs: returns entries (evidence: `README.md`)
- HTTP API → URL Safety Checks: tests URLs (evidence: `README.md`)
- HTTP API → Source Selection: restores source (evidence: `README.md`)
- App Initialization → Configuration: loads and saves (evidence: `main.go`)
- App Initialization → Schedule and Quota: restores running state (evidence: `README.md`)
- Schedule and Quota → Source Selection: selects sources (evidence: `README.md`)
- Schedule and Quota → Download Worker: starts downloads (evidence: `README.md`)
- Download Worker → URL Safety Checks: validates URL (evidence: `main.go`)
- Download Worker → Download Sources: downloads from (evidence: `README.md`)
- Download Worker → Discarded Data: discards bytes (evidence: `README.md`)
- Download Worker → Live Monitoring: records rate (evidence: `README.md`)
- Live Monitoring → Traffic History: updates totals (evidence: `README.md`)
- Live Monitoring → Daily Logs: records events (evidence: `README.md`)
- App Initialization → Process Priority: sets low priority (evidence: `main.go`)
