This project is a SOCKS5 to HTTP proxy server written in Rust. It allows clients to connect to the internet through an HTTP proxy server using SOCKS5 protocol.
- SOCKS5 server with user/password authentication (always succeeds - see note below)
- Forwards traffic to a configured HTTP proxy server
- Logs connection details and timings (connection establishment, authentication, data transfer)
Note: Currently, authentication on the SOCKS5 server always succeeds. This is to make forwarding credentials to HTTP proxy possible.
Requirements:
- Rust compiler (https://www.rust-lang.org/tools/install)
Building:
- Clone the repository:
git clone https://github.com/1zun4/socks2http.git
- Navigate to the project directory:
cd socks2http
- Build the project:
cargo build
Running:
- Run the server:
cargo run
Client Usage:
You can use any SOCKS5 client to connect to the server. Here's an example using curl
:
curl -x socks5://127.0.0.1:42000 -U "username_of_http:password_of_http" https://ipinfo.io/json
This command will connect to https://ipinfo.io/json
through the SOCKS5 server running on localhost:42000
, using the provided username and password for HTTP proxy authentication.
Configuration
- The SOCKS5 server listens on
127.0.0.1:42000
by default. You can change this by modifying thePROXY_SOCKS5_ADDR
constant in the source code. - The HTTP proxy server address is configured in the
PROXY_HTTP_ADDR
constant. You need to replace it with the actual address of your HTTP proxy server.
Logging
The project uses the env_logger
crate for logging. You can adjust the verbosity level by setting the RUST_LOG
environment variable before running the server. For example:
RUST_LOG=info cargo run
This will only log informational messages.
We welcome contributions to this project! Please use common sense when contributing.
This project is licensed under the GNU General Public License v3.0. A copy of the license is available in the LICENSE: LICENSE file.