#socks5 #performance #fast #async-await #with #async-std

fast-socks5

Fast SOCKS5 client/server implementation written in Rust async/.await (with async-std)

9 releases

0.4.2 Feb 3, 2021
0.4.1 Dec 22, 2020
0.4.0 Nov 13, 2020
0.3.3 Oct 12, 2020
0.1.2 Jan 13, 2020

#95 in Network programming

Download history 974/week @ 2020-11-13 775/week @ 2020-11-20 520/week @ 2020-11-27 754/week @ 2020-12-04 547/week @ 2020-12-11 418/week @ 2020-12-18 561/week @ 2020-12-25 860/week @ 2021-01-01 1680/week @ 2021-01-08 1121/week @ 2021-01-15 503/week @ 2021-01-22 288/week @ 2021-01-29 316/week @ 2021-02-05 424/week @ 2021-02-12 363/week @ 2021-02-19 292/week @ 2021-02-26

3,160 downloads per month
Used in 4 crates (3 directly)

MIT license

55KB
1K SLoC

SOCKS5 client/server library using async/.await

License crates.io dependency status Release

🚸 Currently it’s in heavy development and may frequently change.

Features

  • An async/.await SOCKS5 implementation.
  • No unsafe code
  • Built on-top of async-std library
  • Ultra lightweight and scalable
  • No system dependencies
  • Cross-platform
  • Authentication methods:
    • No-Auth method
    • Username/Password auth method
    • Custom auth methods can be implemented via the Authentication Trait
  • All SOCKS5 RFC errors (replies) should be mapped
  • AsyncRead + AsyncWrite traits are implemented on Socks5Stream & Socks5Socket
  • IPv4, IPv6, and Domains types are supported
  • Config helper for Socks5Server
  • Helpers to run a Socks5Server à la "async-std's TcpStream" via incoming.next().await
  • Examples come with real cases commands scenarios
  • Can disable DNS resolving
  • Can skip the authentication/handshake process, which will directly handle command's request (useful to save useless round-trips in an already authenticated environment)
  • Can disable command execution (useful if you just want to forward the request to an another server)

Install

Open in crates.io.

Examples

Please check examples directory.

# Run client
RUST_LOG=debug cargo run --example client -- --socks-server 127.0.0.1:1337 --username admin --password password -a perdu.com -p 80

# Run server
RUST_LOG=debug cargo run --example server -- --listen-addr 127.0.0.1:1337 password -u admin -p password

# Test it with cURL
curl -v --proxy socks5://admin:password@127.0.0.1:1337 https://ipapi.co/json/

TODO

  • Tests have to be implemented
  • Better Rust doc
  • Bind command not implemented
  • UDP command not implemented

Inspired by

Thanks to all these SOCKS5 projects

Further consideration

Dependencies

~2.5–4.5MB
~87K SLoC