use tokio::io::{AsyncReadExt, AsyncWriteExt};
use zeloxy::{Proxy, ProxyResult, ProxyType};
#[tokio::main]
async fn main() -> std::io::Result<()> {
let proxy = Proxy::new("91.132.92.231:80", ProxyType::Http);
match proxy.connect("ipinfo.io", 80).await {
ProxyResult::Ok(mut conn) => {
conn.write_all(b"GET / HTTP/1.0\r\nHost: ipinfo.io\r\n\r\n").await?;
let mut resp = Vec::new();
conn.read_to_end(&mut resp).await?;
println!("{}", String::from_utf8_lossy(&resp));
}
ProxyResult::Err(_) => {} }
Ok(())
}