#![deny(warnings)]
#[tokio::main]
async fn main() -> hpx::Result<()> {
let proxy = hpx::Proxy::all("socks5h://127.0.0.1:9050").expect("tor proxy should be there");
let client = hpx::Client::builder()
.proxy(proxy)
.build()
.expect("should be able to build hpx 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 emulation is configured to use Tor.");
println!("Is Tor: {is_tor}");
assert!(is_tor);
Ok(())
}