# osmiteam-ctrl/tor-gatling-proxy architecture

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

- Interactive diagram: https://gitdiagram.com/osmiteam-ctrl/tor-gatling-proxy
- Repository: https://github.com/osmiteam-ctrl/tor-gatling-proxy

## Overview

This repository implements a Tor proxy pool manager: it loads pool and bridge settings, starts active and standby Tor processes, controls their HAProxy server states, and periodically restarts failed instances or safely rotates idle ones. Startup connectivity checks exercise each instance through its SOCKS port. The graph separates configuration, pool lifecycle, and proxy traffic/control. The README is empty and HAProxy and deployment configuration contents were not provided, so traffic routing is shown as unverified rather than asserted.

Main entry points: [`tor-manager/app.py`](https://github.com/osmiteam-ctrl/tor-gatling-proxy/blob/main/tor-manager/app.py) (Pool manager), [`haproxy/haproxy.cfg`](https://github.com/osmiteam-ctrl/tor-gatling-proxy/blob/main/haproxy/haproxy.cfg) (HAProxy configuration), [`config/proxy-config.yaml`](https://github.com/osmiteam-ctrl/tor-gatling-proxy/blob/main/config/proxy-config.yaml) (Pool settings), [`config/bridges.txt`](https://github.com/osmiteam-ctrl/tor-gatling-proxy/blob/main/config/bridges.txt) (Bridge list)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_configuration["Configuration"]
  node_proxy_config["Pool settings<br/>[proxy-config.yaml]"]
  node_bridges["Bridge list<br/>[bridges.txt]"]
end

subgraph group_pool["Tor pool lifecycle"]
  node_manager["Pool manager<br/>[app.py]"]
  node_instances["Tor instances<br/>[app.py]"]
  node_startup_tests["Connectivity checks<br/>[app.py]"]
end

subgraph group_proxy["Proxy traffic and control"]
  node_haproxy_config["HAProxy configuration<br/>[haproxy.cfg]"]
  node_haproxy["HAProxy"]
  node_tor_socks["Tor SOCKS ports<br/>[app.py]"]
end

node_operator(("Proxy users"))
node_test_endpoints["Test endpoints"]

node_manager -->|"reads settings"| node_proxy_config
node_manager -->|"reads bridges"| node_bridges
node_manager -->|"starts and restarts"| node_instances
node_manager -->|"sets server state"| node_haproxy
node_manager -->|"runs checks"| node_startup_tests
node_startup_tests -->|"proxies requests"| node_tor_socks
node_startup_tests -->|"sends test requests"| node_test_endpoints
node_operator -.->|"sends proxy traffic"| node_haproxy
node_haproxy_config -.->|"configures routing"| node_haproxy
node_haproxy -.->|"forwards traffic"| node_tor_socks

click node_proxy_config "https://github.com/osmiteam-ctrl/tor-gatling-proxy/blob/main/config/proxy-config.yaml"
click node_bridges "https://github.com/osmiteam-ctrl/tor-gatling-proxy/blob/main/config/bridges.txt"
click node_manager "https://github.com/osmiteam-ctrl/tor-gatling-proxy/blob/main/tor-manager/app.py"
click node_instances "https://github.com/osmiteam-ctrl/tor-gatling-proxy/blob/main/tor-manager/app.py"
click node_startup_tests "https://github.com/osmiteam-ctrl/tor-gatling-proxy/blob/main/tor-manager/app.py"
click node_haproxy_config "https://github.com/osmiteam-ctrl/tor-gatling-proxy/blob/main/haproxy/haproxy.cfg"
click node_tor_socks "https://github.com/osmiteam-ctrl/tor-gatling-proxy/blob/main/tor-manager/app.py"

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_proxy_config,node_bridges,node_operator toneBlue
class node_manager,node_instances,node_startup_tests toneAmber
class node_haproxy_config,node_haproxy,node_tor_socks toneMint
class node_test_endpoints toneIndigo
```

## Components

### Configuration

- [Pool settings](https://github.com/osmiteam-ctrl/tor-gatling-proxy/blob/main/config/proxy-config.yaml): `config/proxy-config.yaml`
- [Bridge list](https://github.com/osmiteam-ctrl/tor-gatling-proxy/blob/main/config/bridges.txt): `config/bridges.txt`

### Tor pool lifecycle

- [Pool manager](https://github.com/osmiteam-ctrl/tor-gatling-proxy/blob/main/tor-manager/app.py): `tor-manager/app.py`
- [Tor instances](https://github.com/osmiteam-ctrl/tor-gatling-proxy/blob/main/tor-manager/app.py): `tor-manager/app.py`
- [Connectivity checks](https://github.com/osmiteam-ctrl/tor-gatling-proxy/blob/main/tor-manager/app.py): `tor-manager/app.py`

### Proxy traffic and control

- [HAProxy configuration](https://github.com/osmiteam-ctrl/tor-gatling-proxy/blob/main/haproxy/haproxy.cfg): `haproxy/haproxy.cfg`
- **HAProxy**
- [Tor SOCKS ports](https://github.com/osmiteam-ctrl/tor-gatling-proxy/blob/main/tor-manager/app.py): `tor-manager/app.py`

### Other components

- **Proxy users**
- **Test endpoints**

## Connections

- Pool manager → Pool settings: reads settings (evidence: `tor-manager/app.py`)
- Pool manager → Bridge list: reads bridges (evidence: `tor-manager/app.py`)
- Pool manager → Tor instances: starts and restarts (evidence: `tor-manager/app.py`)
- Pool manager → HAProxy: sets server state (evidence: `tor-manager/app.py`)
- Pool manager → Connectivity checks: runs checks (evidence: `tor-manager/app.py`)
- Connectivity checks → Tor SOCKS ports: proxies requests (evidence: `tor-manager/app.py`)
- Connectivity checks → Test endpoints: sends test requests (evidence: `tor-manager/app.py`)
- Proxy users → HAProxy: sends proxy traffic
- HAProxy configuration → HAProxy: configures routing
- HAProxy → Tor SOCKS ports: forwards traffic
