Crates.io | socks-abstract5 |
lib.rs | socks-abstract5 |
version | |
source | src |
created_at | 2025-02-02 19:42:43.723869 |
updated_at | 2025-02-02 19:42:43.723869 |
description | A Lightweight SOCKS5 implementation without having to install extra system dependencies. |
homepage | |
repository | |
max_upload_size | |
id | 1539816 |
Cargo.toml error: | TOML parse error at line 17, column 1 | 17 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
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.