A high-performance SOCKS5 proxy server implementation in C++ with UDP relay support.
- SOCKS5 proxy server (RFC 1928)
- TCP CONNECT command
- UDP ASSOCIATE command for UDP relay
- Cross-platform (Windows and Linux)
- IPv4 and IPv6 support
- Domain name resolution
- Multi-threaded client handling
- Non-blocking I/O for efficient data relay
- C++17 compatible compiler (GCC 7+, Clang 5+, MSVC 2017+)
- CMake 3.15 or higher
# Clone the repository
git clone https://github.com/definisi/socks5-proxy-server-cpp.git
cd socks5-proxy-server-cpp
# Create build directory
mkdir build
cd build
# Configure and build
cmake ..
make
# Run the server
./bin/Release/socks5_proxy_server# Clone the repository
git clone https://github.com/definisi/socks5-proxy-server-cpp.git
cd socks5-proxy-server-cpp
# Build using batch script
.\build.bat
# Run the server
.\build\bin\Release\socks5_proxy_server.exeBy default, the server listens on 0.0.0.0:1080 for SOCKS5 connections.
# Test SOCKS5 proxy
curl --socks5-hostname 127.0.0.1:1080 https://example.com# Run the included test script
python test/test_socks5.pyYou can configure your browser to use the SOCKS5 proxy:
- SOCKS5 Proxy: 127.0.0.1:1080
/src/
├── main.cpp - Entry point
├── socks5_server.hpp - SOCKS5 server header
├── socks5_server_fixed.cpp - SOCKS5 core logic (fixed version)
├── udp_relay.cpp - UDP relay logic
├── udp_relay.hpp - UDP relay header
├── config.hpp - Config & constants
├── platform/
│ ├── net.hpp - Network abstraction layer
│ ├── net_win.cpp - Windows socket API
│ └── net_unix.cpp - Linux socket API
/test/
└── test_socks5.py - Python test script
This project is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License.
You may use, share, and modify the code as long as you give appropriate credit and do not use it for commercial purposes.
View the full license at: https://creativecommons.org/licenses/by-nc/4.0/
Contributions are welcome! Please feel free to submit a Pull Request.