# 7ang0n1n3/omatorsurf architecture

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

- Interactive diagram: https://gitdiagram.com/7ang0n1n3/omatorsurf
- Repository: https://github.com/7ang0n1n3/omatorsurf

## Overview

omatorsurf is a Rust CLI for system-wide Tor routing on Arch Linux/Omarchy. The main workflow is a user invoking `start`: the CLI hands the operation to the controller, which installs firewall protection, starts application Tor, and verifies the protected route; `status` and `check` observe the resulting state. The repository also documents a Quickshell taskbar plugin and a root-owned status publisher. Relationships for sampled Rust modules are supported by source references; broader workflow and plugin links rely on the README, since plugin UI and most controller logic were not excerpted.

Main entry points: [`src/controller.rs`](https://github.com/7ang0n1n3/omatorsurf/blob/main/src/controller.rs) (Routing controller), [`src/command.rs`](https://github.com/7ang0n1n3/omatorsurf/blob/main/src/command.rs) (Command runner), [`src/firewall.rs`](https://github.com/7ang0n1n3/omatorsurf/blob/main/src/firewall.rs) (Firewall rules), [`src/tor.rs`](https://github.com/7ang0n1n3/omatorsurf/blob/main/src/tor.rs) (Tor service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI and orchestration"]
  node_main["Process entry<br/>[main.rs]"]
  node_cli["CLI commands<br/>[cli.rs]"]
  node_controller["Routing controller<br/>[controller.rs]"]
  node_config["Configuration<br/>[config.rs]"]
  node_privilege["Privilege checks<br/>[privilege.rs]"]
  node_runtime[("Runtime lock/state<br/>[runtime.rs]")]
  node_command["Command runner<br/>[command.rs]"]
end

subgraph group_protection["Routing protection"]
  node_firewall["Firewall rules<br/>[firewall.rs]"]
  node_dns["DNS support<br/>[dns.rs]"]
  node_tor["Tor service<br/>[tor.rs]"]
  node_network["Route probes<br/>[network.rs]"]
end

subgraph group_observation["Status and diagnostics"]
  node_status["Status output<br/>[status.rs]"]
  node_health["Health checks<br/>[health.rs]"]
end

subgraph group_desktop["Desktop integration"]
  node_plugin["Taskbar widget<br/>[BarWidget.qml]"]
  node_plugin_backend["Plugin backend<br/>[Backend.qml]"]
  node_publisher["Status publisher<br/>[omatorsurf-bar.py]"]
end

node_user(("Operator"))
node_system["Linux services"]
node_tor_network(("Tor network"))
node_desktop_user(("Desktop user"))

node_user -->|"invokes"| node_main
node_main -->|"dispatches"| node_cli
node_cli -->|"routes commands"| node_controller
node_controller -->|"loads settings"| node_config
node_controller -->|"manages rules"| node_firewall
node_controller -->|"starts service"| node_tor
node_controller -->|"verifies route"| node_network
node_controller -->|"formats observations"| node_status
node_controller -->|"runs checks"| node_health
node_controller -.->|"records operation"| node_runtime
node_controller -->|"checks access"| node_privilege
node_firewall -->|"runs nft"| node_command
node_tor -->|"runs service commands"| node_command
node_network -->|"runs route probes"| node_command
node_controller -->|"uses DNS support"| node_dns
node_command -->|"executes commands"| node_system
node_firewall -->|"applies nft rules"| node_system
node_tor -->|"controls systemd"| node_system
node_network -->|"checks exit route"| node_tor_network
node_desktop_user -->|"uses controls"| node_plugin
node_plugin -.->|"opens controls"| node_plugin_backend
node_plugin_backend -->|"reads observations"| node_publisher
node_plugin_backend -->|"requests changes"| node_main

click node_main "https://github.com/7ang0n1n3/omatorsurf/blob/main/src/main.rs"
click node_cli "https://github.com/7ang0n1n3/omatorsurf/blob/main/src/cli.rs"
click node_controller "https://github.com/7ang0n1n3/omatorsurf/blob/main/src/controller.rs"
click node_config "https://github.com/7ang0n1n3/omatorsurf/blob/main/src/config.rs"
click node_privilege "https://github.com/7ang0n1n3/omatorsurf/blob/main/src/privilege.rs"
click node_runtime "https://github.com/7ang0n1n3/omatorsurf/blob/main/src/runtime.rs"
click node_command "https://github.com/7ang0n1n3/omatorsurf/blob/main/src/command.rs"
click node_firewall "https://github.com/7ang0n1n3/omatorsurf/blob/main/src/firewall.rs"
click node_dns "https://github.com/7ang0n1n3/omatorsurf/blob/main/src/dns.rs"
click node_tor "https://github.com/7ang0n1n3/omatorsurf/blob/main/src/tor.rs"
click node_network "https://github.com/7ang0n1n3/omatorsurf/blob/main/src/network.rs"
click node_status "https://github.com/7ang0n1n3/omatorsurf/blob/main/src/status.rs"
click node_health "https://github.com/7ang0n1n3/omatorsurf/blob/main/src/health.rs"
click node_plugin "https://github.com/7ang0n1n3/omatorsurf/blob/main/quickshell-plugin/BarWidget.qml"
click node_plugin_backend "https://github.com/7ang0n1n3/omatorsurf/blob/main/quickshell-plugin/Backend.qml"
click node_publisher "https://github.com/7ang0n1n3/omatorsurf/blob/main/quickshell-plugin/scripts/omatorsurf-bar.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_main,node_cli,node_controller,node_config,node_privilege,node_runtime,node_command,node_desktop_user toneBlue
class node_firewall,node_dns,node_tor,node_network toneAmber
class node_status,node_health toneMint
class node_plugin,node_plugin_backend,node_publisher toneRose
class node_user,node_system,node_tor_network toneIndigo
```

## Components

### CLI and orchestration

- [Process entry](https://github.com/7ang0n1n3/omatorsurf/blob/main/src/main.rs): `src/main.rs`
- [CLI commands](https://github.com/7ang0n1n3/omatorsurf/blob/main/src/cli.rs): `src/cli.rs`
- [Routing controller](https://github.com/7ang0n1n3/omatorsurf/blob/main/src/controller.rs): `src/controller.rs`
- [Configuration](https://github.com/7ang0n1n3/omatorsurf/blob/main/src/config.rs): `src/config.rs`
- [Privilege checks](https://github.com/7ang0n1n3/omatorsurf/blob/main/src/privilege.rs): `src/privilege.rs`
- [Runtime lock/state](https://github.com/7ang0n1n3/omatorsurf/blob/main/src/runtime.rs): `src/runtime.rs`
- [Command runner](https://github.com/7ang0n1n3/omatorsurf/blob/main/src/command.rs): `src/command.rs`

### Routing protection

- [Firewall rules](https://github.com/7ang0n1n3/omatorsurf/blob/main/src/firewall.rs): `src/firewall.rs`
- [DNS support](https://github.com/7ang0n1n3/omatorsurf/blob/main/src/dns.rs): `src/dns.rs`
- [Tor service](https://github.com/7ang0n1n3/omatorsurf/blob/main/src/tor.rs): `src/tor.rs`
- [Route probes](https://github.com/7ang0n1n3/omatorsurf/blob/main/src/network.rs): `src/network.rs`

### Status and diagnostics

- [Status output](https://github.com/7ang0n1n3/omatorsurf/blob/main/src/status.rs): `src/status.rs`
- [Health checks](https://github.com/7ang0n1n3/omatorsurf/blob/main/src/health.rs): `src/health.rs`

### Desktop integration

- [Taskbar widget](https://github.com/7ang0n1n3/omatorsurf/blob/main/quickshell-plugin/BarWidget.qml): `quickshell-plugin/BarWidget.qml`
- [Plugin backend](https://github.com/7ang0n1n3/omatorsurf/blob/main/quickshell-plugin/Backend.qml): `quickshell-plugin/Backend.qml`
- [Status publisher](https://github.com/7ang0n1n3/omatorsurf/blob/main/quickshell-plugin/scripts/omatorsurf-bar.py): `quickshell-plugin/scripts/omatorsurf-bar.py`

### Other components

- **Operator**
- **Linux services**
- **Tor network**
- **Desktop user**

## Connections

- Operator → Process entry: invokes (evidence: `README.md`)
- Process entry → CLI commands: dispatches (evidence: `src/main.rs`)
- CLI commands → Routing controller: routes commands (evidence: `src/cli.rs`)
- Routing controller → Configuration: loads settings (evidence: `README.md`)
- Routing controller → Firewall rules: manages rules (evidence: `README.md`)
- Routing controller → Tor service: starts service (evidence: `README.md`)
- Routing controller → Route probes: verifies route (evidence: `README.md`)
- Routing controller → Status output: formats observations (evidence: `README.md`)
- Routing controller → Health checks: runs checks (evidence: `README.md`)
- Routing controller → Runtime lock/state: records operation
- Routing controller → Privilege checks: checks access (evidence: `README.md`)
- Firewall rules → Command runner: runs nft (evidence: `src/firewall.rs`)
- Tor service → Command runner: runs service commands (evidence: `src/tor.rs`)
- Route probes → Command runner: runs route probes (evidence: `src/network.rs`)
- Routing controller → DNS support: uses DNS support (evidence: `src/controller.rs`)
- Command runner → Linux services: executes commands (evidence: `src/command.rs`)
- Firewall rules → Linux services: applies nft rules (evidence: `README.md`)
- Tor service → Linux services: controls systemd (evidence: `src/tor.rs`)
- Route probes → Tor network: checks exit route (evidence: `README.md`)
- Desktop user → Taskbar widget: uses controls (evidence: `README.md`)
- Taskbar widget → Plugin backend: opens controls
- Plugin backend → Status publisher: reads observations (evidence: `README.md`)
- Plugin backend → Process entry: requests changes (evidence: `README.md`)
