async-proxy: fast proxy clients implementation
Async proxy is a fast and flexible, as well as asyncronous implementation of proxy clients in the Rust programming language
Getting started
Add the line below in your Cargo.toml
file
async-proxy = "0.1.1"
Protocols
Since it is the first stable version of the library (it has been created yesterday, lol), currently the only supported protocol is the Socks4
proxification protocol.
We are working on these protocols, and, we hope, they will be released in the coming days
- SOCKS4 (Stable)
- SOCKS5 (Working on, WIP)
- HTTP(s) (Working on, WIP)
Example
An example of using an async-proxy Socks4
protocol implementation without ident
in connection needed
use async_proxy::clients::socks4::no_ident::{
Socks4NoIdent, ConnParams
};
use async_proxy::general::ConnectionTimeouts;
use async_proxy::proxy::ProxyStream;
use tokio::net::TcpStream;
use std::net::{
SocketAddr, SocketAddrV4,
IpAddr, Ipv4Addr
};
use std::time::Duration;
#[tokio::main]
async fn main() {
const PROXY_IPADDR: Ipv4Addr = Ipv4Addr::new(104, 248, 63, 15);
const PROXY_PORT: u16 = 30_588;
let proxy_addr: SocketAddr = SocketAddr::new(IpAddr::V4(PROXY_IPADDR), PROXY_PORT);
let timeouts = ConnectionTimeouts::new(
Duration::from_secs(8),
Duration::from_secs(8),
Duration::from_secs(8)
);
const DEST_IPADDR: Ipv4Addr = Ipv4Addr::new(52, 20, 16, 20);
let DEST_PORT: u16 = 30_000;
let dest_addr: SocketAddrV4 = SocketAddrV4::new(DEST_IPADDR, DEST_PORT);
let connection_params = ConnParams::new(dest_addr, timeouts);
let stream = TcpStream::connect(proxy_addr)
.await
.expect("Unable to connect to the proxy server");
let stream = match Socks4NoIdent::connect(stream, connection_params).await {
Ok(stream) => stream ,
Err(error) => {
}
};
}
More examples can be found here