# bariskisir/torrotatinghttpproxy architecture

> Architecture diagram of the GitHub repository bariskisir/torrotatinghttpproxy, 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/bariskisir/torrotatinghttpproxy
- Repository: https://github.com/bariskisir/torrotatinghttpproxy

## Overview

TorRotatingHttpProxy accepts unauthenticated HTTP and CONNECT proxy traffic, routes it through verified Tor exits, and rotates or reuses those exits according to policy. Its companion dashboard exposes live instance status, IP history, and a built-in proxy load test. The graph follows the documented workflow and sampled ownership; Tor circuit and proxy details are partly documented but not fully shown in the excerpts.

Main entry points: [`internal/app/run.go`](https://github.com/bariskisir/torrotatinghttpproxy/blob/master/internal/app/run.go) (Runtime orchestration), [`internal/app/web.go`](https://github.com/bariskisir/torrotatinghttpproxy/blob/master/internal/app/web.go) (Dashboard API), [`internal/app/proxy.go`](https://github.com/bariskisir/torrotatinghttpproxy/blob/master/internal/app/proxy.go) (HTTP proxy), [`internal/app/tor.go`](https://github.com/bariskisir/torrotatinghttpproxy/blob/master/internal/app/tor.go) (Tor workers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_startup["Application runtime"]
  node_entry["CLI entry<br/>[main.go]"]
  node_config["Configuration<br/>[config.go]"]
  node_runtime["Runtime orchestration<br/>[run.go]"]
end

subgraph group_tor["Tor lifecycle"]
  node_workers["Tor workers<br/>[tor.go]"]
  node_control["Control protocol<br/>[control.go]"]
end

subgraph group_proxy["Proxy routing"]
  node_pool["Verified exit pool<br/>[pool.go]"]
  node_proxy_handler["HTTP proxy<br/>[proxy.go]"]
end

subgraph group_dashboard["Dashboard and state"]
  node_sqlite[("SQLite history")]
  node_store["IP history store<br/>[store.go]"]
  node_web["Dashboard API<br/>[web.go]"]
  node_tester["Proxy load tester<br/>[loadtest.go]"]
  node_ui["Dashboard UI<br/>[app.js]"]
end

node_operator(("Operator"))
node_proxy_client(("Proxy client"))
node_browser(("Dashboard browser"))
node_destination(("HTTP destination"))
node_ip_check(("IP check service"))
node_tor_process["Tor processes"]

node_operator -->|"starts"| node_entry
node_entry -->|"loads"| node_config
node_entry -->|"runs"| node_runtime
node_runtime -->|"opens"| node_store
node_runtime -->|"creates"| node_pool
node_runtime -->|"starts"| node_workers
node_runtime -->|"serves"| node_proxy_handler
node_runtime -->|"serves"| node_web
node_runtime -->|"creates"| node_tester
node_workers -->|"starts"| node_tor_process
node_workers -->|"commands"| node_control
node_workers -->|"checks exits"| node_ip_check
node_workers -->|"publishes exits"| node_pool
node_pool -->|"reserves IPs"| node_store
node_store -->|"reads/writes"| node_sqlite
node_proxy_client -->|"sends requests"| node_proxy_handler
node_proxy_handler -->|"acquires lease"| node_pool
node_proxy_handler -->|"dials via lease"| node_tor_process
node_proxy_handler -->|"forwards traffic"| node_destination
node_browser -->|"requests API"| node_web
node_web -->|"snapshots"| node_pool
node_web -->|"lists IPs"| node_store
node_web -->|"starts/stops"| node_tester
node_web -->|"serves assets"| node_ui
node_ui -->|"fetches updates"| node_web
node_tester -->|"tests via proxy"| node_proxy_handler

click node_entry "https://github.com/bariskisir/torrotatinghttpproxy/blob/master/cmd/torproxy/main.go"
click node_config "https://github.com/bariskisir/torrotatinghttpproxy/blob/master/internal/app/config.go"
click node_runtime "https://github.com/bariskisir/torrotatinghttpproxy/blob/master/internal/app/run.go"
click node_workers "https://github.com/bariskisir/torrotatinghttpproxy/blob/master/internal/app/tor.go"
click node_control "https://github.com/bariskisir/torrotatinghttpproxy/blob/master/internal/app/control.go"
click node_pool "https://github.com/bariskisir/torrotatinghttpproxy/blob/master/internal/app/pool.go"
click node_proxy_handler "https://github.com/bariskisir/torrotatinghttpproxy/blob/master/internal/app/proxy.go"
click node_store "https://github.com/bariskisir/torrotatinghttpproxy/blob/master/internal/app/store.go"
click node_web "https://github.com/bariskisir/torrotatinghttpproxy/blob/master/internal/app/web.go"
click node_tester "https://github.com/bariskisir/torrotatinghttpproxy/blob/master/internal/app/loadtest.go"
click node_ui "https://github.com/bariskisir/torrotatinghttpproxy/blob/master/internal/app/static/app.js"

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_entry,node_config,node_runtime,node_proxy_client,node_browser toneBlue
class node_workers,node_control toneAmber
class node_pool,node_proxy_handler toneMint
class node_sqlite,node_store,node_web,node_tester,node_ui toneRose
class node_operator,node_destination,node_ip_check,node_tor_process toneIndigo
```

## Components

### Application runtime

- [CLI entry](https://github.com/bariskisir/torrotatinghttpproxy/blob/master/cmd/torproxy/main.go): `cmd/torproxy/main.go`
- [Configuration](https://github.com/bariskisir/torrotatinghttpproxy/blob/master/internal/app/config.go): `internal/app/config.go`
- [Runtime orchestration](https://github.com/bariskisir/torrotatinghttpproxy/blob/master/internal/app/run.go): `internal/app/run.go`

### Tor lifecycle

- [Tor workers](https://github.com/bariskisir/torrotatinghttpproxy/blob/master/internal/app/tor.go): `internal/app/tor.go`
- [Control protocol](https://github.com/bariskisir/torrotatinghttpproxy/blob/master/internal/app/control.go): `internal/app/control.go`

### Proxy routing

- [Verified exit pool](https://github.com/bariskisir/torrotatinghttpproxy/blob/master/internal/app/pool.go): `internal/app/pool.go`
- [HTTP proxy](https://github.com/bariskisir/torrotatinghttpproxy/blob/master/internal/app/proxy.go): `internal/app/proxy.go`

### Dashboard and state

- **SQLite history**
- [IP history store](https://github.com/bariskisir/torrotatinghttpproxy/blob/master/internal/app/store.go): `internal/app/store.go`
- [Dashboard API](https://github.com/bariskisir/torrotatinghttpproxy/blob/master/internal/app/web.go): `internal/app/web.go`
- [Proxy load tester](https://github.com/bariskisir/torrotatinghttpproxy/blob/master/internal/app/loadtest.go): `internal/app/loadtest.go`
- [Dashboard UI](https://github.com/bariskisir/torrotatinghttpproxy/blob/master/internal/app/static/app.js): `internal/app/static/app.js`

### Other components

- **Operator**
- **Proxy client**
- **Dashboard browser**
- **HTTP destination**
- **IP check service**
- **Tor processes**

## Connections

- Operator → CLI entry: starts
- CLI entry → Configuration: loads
- CLI entry → Runtime orchestration: runs
- Runtime orchestration → IP history store: opens
- Runtime orchestration → Verified exit pool: creates
- Runtime orchestration → Tor workers: starts
- Runtime orchestration → HTTP proxy: serves
- Runtime orchestration → Dashboard API: serves
- Runtime orchestration → Proxy load tester: creates
- Tor workers → Tor processes: starts
- Tor workers → Control protocol: commands
- Tor workers → IP check service: checks exits
- Tor workers → Verified exit pool: publishes exits
- Verified exit pool → IP history store: reserves IPs
- IP history store → SQLite history: reads/writes
- Proxy client → HTTP proxy: sends requests
- HTTP proxy → Verified exit pool: acquires lease
- HTTP proxy → Tor processes: dials via lease
- HTTP proxy → HTTP destination: forwards traffic
- Dashboard browser → Dashboard API: requests API
- Dashboard API → Verified exit pool: snapshots
- Dashboard API → IP history store: lists IPs
- Dashboard API → Proxy load tester: starts/stops
- Dashboard API → Dashboard UI: serves assets
- Dashboard UI → Dashboard API: fetches updates
- Proxy load tester → HTTP proxy: tests via proxy
