Crates.io | tor-tunnels |
lib.rs | tor-tunnels |
version | 0.1.2 |
source | src |
created_at | 2024-12-01 20:52:00.969586 |
updated_at | 2024-12-01 21:07:52.757661 |
description | Create bindadle TCP tunnels to hidden services (.onion) over Tor |
homepage | |
repository | https://git.haveno.com/haveno/packages/tor-tunnels |
max_upload_size | |
id | 1467829 |
size | 28,864 |
This application creates a TCP tunnel that allows clients to connect to a Tor hidden service through a SOCKS5 proxy. It listens for incoming TCP connections, connects to the hidden service using the provided SOCKS5 proxy, and then forwards data between the client and the hidden service.
tokio
: For asynchronous runtime.tokio-socks
: A library to work with SOCKS5 proxies in Tokio.tokio-io
: For handling bidirectional I/O between the client and hidden service.Clone the repository:
git clone https://github.com/KewbitXMR/tor-tunnels.git
cd tor-tunnels
Add dependencies to your Cargo.toml
:
[dependencies]
tokio = { version = "1", features = ["full"] }
tokio-socks = "0.1.4"
Build the project:
cargo build --release
Before running the application, you need to configure the following parameters:
listen_addr
: The local address and port the tunnel will listen on for incoming connections (e.g., 127.0.0.1:5656
).socks5_proxy
: The SOCKS5 proxy address to use for connecting to the Tor network (e.g., 127.0.0.1:9050
for a local Tor proxy).hidden_service_addr
: The address and port of the hidden service you want to tunnel to (e.g., 5i6blbmuflq4s4im6zby26a7g22oef6kyp7vbwyru6oq5e36akzo3ayd.onion:2001
).You can adjust these values in the main
function of src/main.rs
as needed.
Run the application:
cargo run --release
The server will start listening on the listen_addr
(e.g., 127.0.0.1:5656
) for incoming connections.
Clients can connect to the specified address and port. The server will then establish a connection to the hidden service through the SOCKS5 proxy and forward the data between the client and the hidden service.
main
function binds a TCP listener to listen_addr
and waits for incoming connections.tokio::spawn
.handle_client
function:
Socks5Stream::connect
.tokio::io::copy_bidirectional
.It's only useful for one perpose at the moment as I'm focusing on something else, currently you have to build it with the hidden service hardcoded, but in future it will be a library which you can create, destroy tunnels in runtime, perhaps exposing an RPC API for other none rust applications too.
Developed and maintainted by Kewbit originally for use in the haveno desktop client.