# verity-freedom/tor-portable architecture

> Architecture diagram of the GitHub repository verity-freedom/tor-portable, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-10-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/verity-freedom/tor-portable
- Repository: https://github.com/verity-freedom/tor-portable

## Overview

##### Project type and purpose
- This is an open-source, fully portable tooling bundle (“Tor Portable”) that ships a fine-tuned Tor core plus helper scripts for Windows (CMD/EXE) and Linux (SH), external integrations (IPFS/IPNS updater, Discord mods), and instructions for browser proxy extensions. Its goal is to free Tor from the browser and simplify deployment on Win7, Win8+, Linux.

##### File structure
- Top-level scripts (AntiTor.*, service-manager.*, updater.*, change-mode.*, conjure.sh, discord.sh, etc.) are wrappers around the Tor binary and configurations.
- No source folders—this is primarily a distribution of binaries + configuration + orchestration scripts.
- Updater scripts implement an IPNS-based update mechanism.
- Two executables (AntiTor.exe, Tor Portable core) plus many shell/CMD scripts indicate cross-platform support.

##### Key insights from README
- Core components: Tor Expert Bundle, custom torrc configs (default vs pro modes), Win7 patch, IPFS/IPNS updater, ZeroOmega/WebRTC Control integration, optional Psiphon.
- Workflow: user runs scripts to start Tor, enable a system service, switch modes, update, or route Discord.
- External dependencies: IPFS/IPNS pinning services, browser extensions, third-party proxy helpers.

a. Main components to represent:
- Operating System (Windows or Linux)
- Tor Core Service (Tor Expert Bundle + patched binaries)
- Configuration Manager (change-mode.sh/.cmd toggles default vs pro torrc)
- Service Manager (service-manager scripts install/uninstall Tor as a service)
- Launcher (AntiTor scripts start Tor in the foreground per session)
- Updater (updater.sh/.cmd—connects to IPNS gateway to fetch new releases)
- External Proxy Tools (Discord-*, proxifyre/tun2socks optional wrappers)
- Browser Extensions (ZeroOmega, WebRTC Control)
- External Networks: IPFS/IPNS network, Tor network, Internet

b. Relationships and interactions:
- OS invokes Launcher or Service Manager → configures and starts Tor Core
- Configuration Manager swaps torrc files before launch
- Updater contacts IPNS via pinata.cloud/ipns.ipfs.network → downloads & replaces binaries/configs
- Browser (Chrome/Firefox) talks to Tor via ZeroOmega/WebRTC Control → Tor Core → Tor network → Internet
- Optional tools (Discord mods, Psiphon) can be chained after Tor Core or used in place of Tor in browser extension settings

c. Architectural patterns/design principles:
- Modular CLI wrappers (each script has one responsibility: start, serviceize, update, patch, mode switch)
- Portable, stateless distribution: no required installation, purely file-based execution
- Layered proxy stack: application (browser/Discord) → local Tor → IPFS update layer → Tor network

d. Relevant technologies/frameworks:
- Tor Expert Bundle (tor.exe/tor binaries)
- Shell scripts (sh) and Windows batch (cmd)
- IPFS/IPNS for updates
- ZeroOmega & WebRTC Control browser extensions
- Optional third-party helpers: Psiphon, proxifyre, tun2socks

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Operating Systems
    subgraph "Operating System"
        OS_Win["Windows"]:::external
        OS_Linux["Linux"]:::external
    end

    %% CLI Wrappers
    subgraph "CLI Wrappers"
        Launcher_SH("AntiTor.sh"):::script
        Launcher_CMD("AntiTor.cmd"):::script
        Service_Manager_SH("service-manager.sh"):::script
        Service_Manager_CMD("service-manager.cmd"):::script
        Service_Check("service-check.sh"):::script
        Config_SH("change-mode.sh"):::script
        Config_CMD("change-mode.cmd"):::script
        Updater_SH("updater.sh"):::script
        Updater_CMD("updater-win10+.cmd"):::script
        Discord_SH("discord.sh"):::script
        Lyrebird("lyrebird.sh"):::script
        Conjure("conjure.sh"):::script
        Full_Stop("full-stop.sh"):::script
    end

    %% Core Service and Configs
    TorCore["Tor Core Service"]:::service
    subgraph "Tor Configs"
        Default_Config["default torrc"]:::config
        Pro_Config["pro torrc"]:::config
    end

    %% Browser Layer
    subgraph "Browser & Extensions"
        Browser["Browser (Chrome/Firefox)"]:::external
        ZeroOmega["ZeroOmega Extension"]:::extension
        WebRTC["WebRTC Control Extension"]:::extension
    end

    Discord_App["Discord App"]:::external
    Psiphon["Psiphon (Optional)"]:::external

    %% External Networks
    IPFS["IPFS/IPNS Network"]:::external
    TorNet["Tor Network"]:::external
    Internet["Internet"]:::external

    %% Relationships
    OS_Win --> Launcher_SH
    OS_Win --> Launcher_CMD
    OS_Linux --> Launcher_SH

    OS_Win --> Service_Manager_SH
    OS_Win --> Service_Manager_CMD
    OS_Linux --> Service_Manager_SH

    Launcher_SH --> Config_SH
    Launcher_CMD --> Config_CMD
    Config_SH --> TorCore
    Config_CMD --> TorCore

    Service_Manager_SH --> Config_SH
    Service_Manager_CMD --> Config_CMD
    Service_Check --> Service_Manager_SH
    Service_Check --> Service_Manager_CMD
    Service_Manager_SH --> TorCore
    Service_Manager_CMD --> TorCore

    Updater_SH --> IPFS
    Updater_CMD --> IPFS
    IPFS --> TorCore

    Discord_SH --> TorCore
    Lyrebird --> TorCore
    Conjure --> TorCore
    Full_Stop --> TorCore

    TorCore --> TorNet
    TorNet --> Internet

    Browser --> ZeroOmega
    Browser --> WebRTC
    ZeroOmega --> TorCore
    WebRTC --> TorCore

    Browser -->|"Optional via Psiphon"| Psiphon
    Psiphon --> TorCore

    Discord_App --> Discord_SH
    Discord_App --> TorCore

    %% Click Events
    click Launcher_SH "https://github.com/verity-freedom/tor-portable/blob/main/AntiTor.sh"
    click Launcher_CMD "https://github.com/verity-freedom/tor-portable/blob/main/AntiTor.cmd"
    click Service_Manager_SH "https://github.com/verity-freedom/tor-portable/blob/main/service-manager.sh"
    click Service_Manager_CMD "https://github.com/verity-freedom/tor-portable/blob/main/service-manager.cmd"
    click Service_Check "https://github.com/verity-freedom/tor-portable/blob/main/service-check.sh"
    click Config_SH "https://github.com/verity-freedom/tor-portable/blob/main/change-mode.sh"
    click Config_CMD "https://github.com/verity-freedom/tor-portable/blob/main/change-mode.cmd"
    click Updater_SH "https://github.com/verity-freedom/tor-portable/blob/main/updater.sh"
    click Updater_CMD "https://github.com/verity-freedom/tor-portable/blob/main/updater-win10+.cmd"
    click Discord_SH "https://github.com/verity-freedom/tor-portable/blob/main/discord.sh"
    click Lyrebird "https://github.com/verity-freedom/tor-portable/blob/main/lyrebird.sh"
    click Conjure "https://github.com/verity-freedom/tor-portable/blob/main/conjure.sh"
    click Full_Stop "https://github.com/verity-freedom/tor-portable/blob/main/full-stop.sh"
    click TorCore "https://github.com/verity-freedom/tor-portable/blob/main/AntiTor.exe"

    %% Styles
    classDef script fill:#D0E8FF,stroke:#0366d6,color:#0366d6,stroke-width:1px,shape:ellipse
    classDef service fill:#D4F4DD,stroke:#2c662d,color:#2c662d,stroke-width:1px
    classDef external fill:#E2E2E2,stroke:#555,color:#333,stroke-width:1px,shape:rect
    classDef extension fill:#FFF4D6,stroke:#b36b00,color:#b36b00,stroke-width:1px
    classDef config fill:#FFF1F0,stroke:#d73a49,color:#d73a49,stroke-width:1px
```
