#[cfg(unix)]
#[tokio::main]
async fn main() -> hpx::Result<()> {
let proxy = hpx::Proxy::unix("/var/run/docker.sock")?;
let client = hpx::Client::builder()
.proxy(proxy.clone())
.timeout(std::time::Duration::from_secs(10))
.build()?;
let resp = client
.get("http://localhost/v1.41/containers/json")
.send()
.await?;
println!("{}", resp.text().await?);
let resp = client
.get("http://localhost/v1.41/containers/json")
.proxy(proxy)
.send()
.await?;
println!("{}", resp.text().await?);
Ok(())
}
#[cfg(not(unix))]
fn main() {}