#socks5-proxy #async-io #vpn #async #proxy

fast-socks5

Fast SOCKS5 client/server implementation written in Rust async/.await (tokio)

25 releases

1.0.0-rc.0 Feb 19, 2025
0.10.0 Dec 18, 2024
0.9.6 Mar 25, 2024
0.9.2 Nov 30, 2023
0.3.0 Jan 19, 2020

#73 in Network programming

Download history 3185/week @ 2024-12-27 7740/week @ 2025-01-03 8554/week @ 2025-01-10 9480/week @ 2025-01-17 9495/week @ 2025-01-24 9155/week @ 2025-01-31 9318/week @ 2025-02-07 7612/week @ 2025-02-14 9325/week @ 2025-02-21 9322/week @ 2025-02-28 9835/week @ 2025-03-07 9204/week @ 2025-03-14 9755/week @ 2025-03-21 10935/week @ 2025-03-28 9943/week @ 2025-04-04 10034/week @ 2025-04-11

42,292 downloads per month
Used in 16 crates (9 directly)

MIT license

125KB
2.5K SLoC

License crates.io dependency status Release


anyIP Proxy

Fast SOCKS5 TCP and UDP client/server library for Rust async (Tokio)


Features

  • An async/.await SOCKS5 implementation.
  • An async/.await SOCKS4 Client implementation.
  • An async/.await SOCKS4a Client implementation.
  • No unsafe code
  • Built on top of the Tokio runtime
  • Ultra lightweight and scalable
  • No system dependencies
  • Cross-platform
  • Infinitely extensible, explicit server API based on typestates for safety
    • You control the request handling, the library only ensures you follow the proper protocol flow
    • Can skip DNS resolution
    • Can skip the authentication/handshake process (not RFC-compliant, for private use, to save on useless round-trips)
    • Instead of proxying in-process, swap out run_tcp_proxy for custom handling to build a router or to use a custom accelerated proxying method
  • Authentication methods:
    • No-Auth method (0x00)
    • Username/Password auth method (0x02)
    • Custom auth methods can be implemented on the server side via the AuthMethod Trait
      • Multiple auth methods with runtime negotiation can be supported, with fast static dispatch (enums can be generated with the auth_method_enums macro)
  • UDP is supported
  • All SOCKS5 RFC errors (replies) should be mapped
  • IPv4, IPv6, and Domains types are supported
  • Exhaustive examples are provided that can be run immediately:
    • client
    • server
    • custom_auth_server
    • router
    • udp_client

This library is maintained by anyip.io a residential and mobile socks5 proxy provider.

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/

Inspired by

Thanks to all these SOCKS5 projects

Further Considerations

Dependencies

~3–12MB
~124K SLoC