| Crates.io | socks-abstract5 |
| lib.rs | socks-abstract5 |
| version | 0.1.0 |
| created_at | 2025-02-02 19:42:43.723869+00 |
| updated_at | 2025-02-02 19:42:43.723869+00 |
| description | A Lightweight SOCKS5 implementation without having to install extra system dependencies. |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1539816 |
| size | 40,055 |
A high-performance, RFC-compliant SOCKS5 proxy implementation in Rust.
Add this to your Cargo.toml:
[dependencies]
socks-abstract5 = "0.1.0"
use socks_abstract5::Socks5Server;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let server = Socks5Server::new("127.0.0.1:1080").await?;
server.run().await?;
Ok(())
}
use socks_abstract5::{Socks5Server, Result};
async fn start_proxy(bind_address: &str) -> Result<()> {
let server = Socks5Server::new(bind_address).await?;
server.run().await
}
socks-abstract5 is built on a fully asynchronous architecture, leveraging Tokio for high-performance I/O operations. The implementation follows a modular design with clear separation of concerns:
Currently supports:
CONNECT (0x01)
BIND (0x02)
UDP ASSOCIATE (0x03)
Comprehensive error handling using custom error types:
pub enum Error {
Io(std::io::Error),
InvalidVersion,
AuthFailed,
InvalidCommand(u8),
InvalidAddrType(u8),
ConnectionNotAllowed,
NetworkUnreachable,
HostUnreachable,
ConnectionRefused,
TtlExpired,
ProtocolError,
AddrTypeNotSupported,
}
Default configuration values:
const DEFAULT_BACKLOG: u32 = 1024;
const BUFFER_SIZE: usize = 8192;
const DEFAULT_TIMEOUT: Duration = Duration::from_secs(300);
Mozilla Public License 2.0 (MPL-2.0)
This implementation follows the SOCKS Protocol Version 5 specification as defined in RFC 1928.