Tor Socks in Rust

use tokio;
use reqwest;

#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
    let proxy = reqwest::Proxy::all("socks5h://127.0.0.1:9050").expect("tor proxy should be there");
    let client = reqwest::Client::builder()
        .proxy(proxy)
        .build()
        .expect("should be able to build reqwest client");

    let res = client.get("https://check.torproject.org").send().await?;
    println!("Status: {}", res.status());

    let text = res.text().await?;
    let is_tor = text.contains("Congratulations. This browser is configured to use Tor.");
    println!("Is Tor: {}", is_tor);
    assert!(is_tor);

    Ok(())
}

выдаёт такую ошибку:

thread 'main' panicked at 'tor proxy should be there: reqwest::Error { kind: Builder, source: "unknown proxy scheme" }', src/main.rs:6:65
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Вопрос что нужно вписать в torrc чтоб все работало?


Ответы (0 шт):