zeloxy 0.5.2

A library for creating lightweight, async, and lag-free proxy connections.
Documentation
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use zeloxy::create_chain;
use zeloxy::important::*;

#[tokio::test]
async fn test_mini_chain() -> ProxyResult<()> {
  let mut chain = create_chain![
    "socks4://98.181.137.83:4145",
    "socks5://212.58.132.5:1080",
    "socks4://98.170.57.249:4145",
    "socks4://184.178.172.14:4145",
  ];

  let mut stream = chain.connect("ipinfo.io", 80, true).await?;

  stream.write_all(b"GET / HTTP/1.0\r\nHost: ipinfo.io\r\n\r\n").await?;

  let mut resp = Vec::new();
  stream.read_to_end(&mut resp).await?;

  println!("{}", String::from_utf8_lossy(&resp));

  Ok(())
}

#[tokio::test]
async fn test_chain_from() {
  let proxies = vec![
    "socks4://98.181.137.83:4145",
    "socks4://98.170.57.249:4145",
    "socks5://212.58.132.5:1080",
  ];

  println!("Цепочка: {:?}", ProxyChain::from(proxies));
}

#[tokio::test]
async fn test_chain_node() {
  let chain = create_chain![
    "socks4://98.181.137.83:4145",
    "socks4://98.170.57.249:4145",
    "socks5://212.58.132.5:1080",
  ];

  println!("Узел: {:?}", chain.node());
  println!("Вход: {:?}", chain.entrance_proxy());
  println!("Выход: {:?}", chain.exit_proxy());
}