Skip to main content

Crate torzy

Crate torzy 

Source
Expand description

Minimal Tor-routed worker launching.

torzy starts one Tor SOCKS route per worker, prepares an isolated worker workspace, and runs a caller-supplied shell command once per worker. The CLI and library both call run, so embedded and command-line behavior stay on the same code path.

The default command is intentionally local and quiet. Network checks are left to the caller-supplied command.

use torzy::{run, LaunchConfig};

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let summary = run(
        LaunchConfig {
            envs: 5,
            command: "printf 'worker=%s ready\\n' \"$TOR_WORKER_ID\"".to_string(),
            ..LaunchConfig::default()
        },
        None,
    )
    .await?;

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

Structs§

LaunchConfig
Configuration for one torzy run.
RunSummary
JSON-friendly run summary that avoids command, route, path, and output data.
WorkerSummary
JSON-friendly worker summary.

Enums§

StreamKind
Output stream that produced a worker line.
TorzyEvent
Runtime event emitted by run.
WorkerStatus
Final worker status.

Constants§

DEFAULT_COMMAND
Local default command used when no command is supplied.

Functions§

expand_command_template
Expand command placeholders for a worker.
generate_tor_routes
Generate local SOCKS route strings from a base port.
redact_line
Redact route strings, runtime paths, and public network-address tokens.
run
Run the configured Tor-routed workers.
validate_tor_routes
Validate that explicit routes are non-empty, unique, and match worker count.