torzy 0.1.2

Tor-routed worker launcher library and CLI for safe, parallel command execution
Documentation

torzy

Crates.io docs.rs License

torzy is a Rust library and CLI for running the same command across multiple isolated workers, each with its own Tor SOCKS route. The launcher handles worker setup, Tor lifecycle, command execution, timeouts, and redacted status output.

Use it when you need repeatable parallel work with network isolation, or when you want consistent worker orchestration without building a custom runner.

Install

cargo install torzy

Release notes

  • 0.1.2 publish pass: metadata/docs/readme refresh and crates/docs polish.
  • 0.1.2 publish pass: metadata/docs/readme refresh and crates/docs polish.
  • 0.1.2 publishes now include refreshed crates.io metadata, docs.rs metadata, and README docs.

If you use managed Tor mode, ensure tor is available on PATH or pass --tor-binary.

CLI quick start

Run with defaults (5 workers, local placeholder command):

torzy

Validate your setup without starting Tor or running real commands:

torzy --dry-run

Change worker count and worker command:

torzy -n 10 -c 'printf "worker=%s ready\n" "$TOR_WORKER_ID"'

Use existing SOCKS routes instead of launching Tor:

torzy --no-manage-tor \
  --tor-routes socks5h://127.0.0.1:9050,socks5h://127.0.0.1:9051 \
  -n 2

Write a summary you can parse in CI or scripts:

torzy -n 4 \
  --summary-json summary.json \
  --pretty-json \
  -c 'cargo test'

What workers receive

torzy injects and/or exposes:

  • TOR_ROUTE
  • TOR_WORKER_ID (also {WORKER_ID} in templates)
  • TORZY_ROOT
  • TORZY_WORKSPACE

The command template also supports:

  • {TOR_ROUTE}
  • {TOR_WORKER_ID} or {WORKER_ID}
  • {TORZY_ROOT}
  • {TORZY_WORKSPACE}

Workers also get isolated workspace environment values, including HOME, TMPDIR, CARGO_HOME, and CARGO_TARGET_DIR.

Proxy variables (ALL_PROXY, HTTPS_PROXY, HTTP_PROXY, CARGO_HTTP_PROXY) are enabled by default and can be turned off with --no-proxy-env.

Publishing and release workflows

torzy is useful for sharding publish-like jobs across independent exits when commands are already safe to run concurrently. Example:

torzy -n 3 \
  --no-proxy-env \
  --env CARGO_REGISTRY_TOKEN="$CARGO_REGISTRY_TOKEN" \
  -c 'CARGO_REGISTRY_TOKEN="$CARGO_REGISTRY_TOKEN" cargo publish --no-verify'

Notes for publish-style commands:

  • Keep --no-verify intentional and only use it when required.
  • Only pass credentials with --env when you actually need them.
  • For dry-run checks before a real publish, use --dry-run or your registry’s staging mode first.

Terminal mode and monitor mode

  • --tui shows route bootstrap progress, worker states, and recent sanitized output.
  • In non-interactive terminals, --tui automatically falls back to plain event logging.
torzy --tui -n 5 -c 'lios --command "printf \"worker=%s ready\\n\" \"$TOR_WORKER_ID\"; sleep 5"'

lios is only an example command. torzy does not require it.

Resource and flow control

  • -j/--max-concurrent limits simultaneously running workers.
  • -t/--timeout-seconds sets per-worker timeout.
  • --memory-limit-mb caps worker memory.
  • --working-directory sets a command working directory.
  • --keep-workspaces preserves worker directories after completion.
  • --summary-json and --pretty-json create machine-readable and human-friendly reports.
  • --root-dir and --tor-data-dir control filesystem placement.

Library usage

use torzy::{run, LaunchConfig};

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let summary = run(
        LaunchConfig {
            envs: 5,
            dry_run: true,
            ..LaunchConfig::default()
        },
        None,
    )
    .await?;

    println!("{} workers succeeded", summary.succeeded);
    Ok(())
}

Use tokio::sync::mpsc::unbounded_channel with run(config, Some(tx)) if you need live events for UI or supervisor code.