Tunnel TCP traffic through SOCKS5 or HTTP using a TUN interface.

Overview

tun2proxy

Tunnel TCP traffic through SOCKS5 or HTTP on Linux.

Authentication not yet supported. Error handling incomplete and too restrictive.

Build

Clone the repository and cd into the project folder. Then run the following:

cargo build --release

Setup

A standard setup, which would route all traffic from your system through the tunnel interface, could look as follows:

# Create a tunnel interface named tun0 which your user can bind to.
sudo ip tuntap add name tun0 mode tun user $USER
sudo ip link set tun0 up

# To prevent a loop, replace 1.2.3.4 with the IP address of the proxy server.
# This will add a route to the proxy server that behaves like the default route.
sudo ip route add 1.2.3.4 $(ip route | grep '^default' | cut -d' ' -f2-)

# Route all your traffic through tun0 without interfering with the default route.
sudo ip route add 8.0.0.0/1 dev tun0
sudo ip route add 0.0.0.0/1 dev tun0

# Again, replace 1.2.3.4 with the IP address of the proxy server.
./target/release/tun2proxy --tun tun0 --socks5 1.2.3.4

Note that if you paste these commands into a shell script, which you then run with sudo, you might want to replace $USER with $SUDO_USER.

CLI

tun2proxy 0.1.0
Tunnel interface to proxy.

USAGE:
    tun2proxy [OPTIONS] --tun <TUN>

FLAGS:
        --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -h, --http <IP:PORT>      HTTP server to use
    -s, --socks5 <IP:PORT>    SOCKS5 server to use
    -t, --tun <TUN>           Name of the tun interface
You might also like...
An easy-to-use tunnel to localhost built in Rust. An alternative to ngrok and frp.

rslocal English | 中文 What is rslocal? Rslocal is like ngrok built in Rust, it builds a tunnel to localhost. Project status support http support tcp su

Hybrid Traffic Mesh Proxy

Hybrid Traffic Mesh Proxy L7 proxy on kubernetes dependencies: routeagent: refresh proxy routes fetched with k8s sdk register routes curl -v --unix-s

Userspace libpcap-based tool to mirror your dns traffic

DNS traffic mirroring tool (dns-mirror) Description Userspace libpcap-based tool. dns-mirror sniffs dns packets on the given interface and proxies it

Hotwire allows you to study network traffic of a few popular protocols in a simple way
Hotwire allows you to study network traffic of a few popular protocols in a simple way

Hotwire Hotwire is a gtk GUI application that leverages the wireshark and tshark infrastructure to capture traffic and explore the contents of tcpdump

a smol tcp/ip stack

smoltcp smoltcp is a standalone, event-driven TCP/IP stack that is designed for bare-metal, real-time systems. Its design goals are simplicity and rob

A high performance TCP SYN port scanner.

Armada A High-Performance TCP SYN scanner What is Armada? Armada is a high performance TCP SYN scanner. This is equivalent to the type of scanning tha

A tcp over http2 + tls proxy

mtunnel A tcp over http2 + tls proxy. Usage 1. get certificates, by following steps. 2. make your config client config: { "local_addr": "127.0.0.1

🤖 brwrs is a new protocol running over TCP/IP that is intended to be a suitable candidate for terminal-only servers

brwrs is a new protocol running over TCP/IP that is intended to be a suitable candidate for terminal-only servers (plain text data). That is, although it can be accessed from a browser, brwrs will not correctly interpret the browser's GET request.

TCP is so widely used, however QUIC may have a better performance.

TCP is so widely used, however QUIC may have a better performance. For softwares which use protocols built on TCP, this program helps them take FULL advantage of QUIC.

Comments
  • Cleaning and update

    Cleaning and update

    Hey!

    Just is case this repo is still active, I'd like to submit this pull request to you so it remains up to date :)

    I will probably continue to do some editing since they are some little things to improve and I have new ideas.

    Feel free to edit what I did!

    opened by dxfgg17 3
  • Use log for logging

    Use log for logging

    Use log crate for generating info and error output.

    In order to maintain same verbosity, set default log level to 'info'. Can be overridden by setting the RUST_LOG env variable, e.g. RUST_LOG=error.

    opened by kujeger 2
  • thread 'main' panicked at 'called `Option::unwrap()`

    thread 'main' panicked at 'called `Option::unwrap()`

    hi I got panic after run tun

    [2022-10-19T05:19:00Z INFO  tun2proxy::tun2proxy] CLOSE 192.168.100.103:41194 -> x.x.x.x:48022
    thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/tun2proxy.rs:442:72
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    
    
    opened by Ja7ad 1
Owner
B. Blechschmidt
B. Blechschmidt
A remote shell, TCP tunnel and HTTP proxy for Replit.

Autobahn A remote shell, TCP tunnel and HTTP proxy for Replit. Hybrid SSH/HTTP server for Replit. Based on leon332157/replish. Autobahn runs a WebSock

Patrick Winters 12 Sep 24, 2022
Lightweight proxy that allows redirect HTTP(S) traffic through a proxy.

Proxyswarm Proxyswarm is a lightweight proxy that allows redirect HTTP(S) traffic through a proxy. WARNING: This app isn't recomended for download lar

Jorge Alejandro Jimenez Luna 4 Apr 16, 2022
A modern, simple TCP tunnel in Rust that exposes local ports to a remote server, bypassing standard NAT connection firewalls

bore A modern, simple TCP tunnel in Rust that exposes local ports to a remote server, bypassing standard NAT connection firewalls. That's all it does:

Eric Zhang 6.2k Dec 31, 2022
A proxy implement with http / socks5 in-bound and vmess out-bound, written in Rust and tokio.rs

tokio-vmess an Asynchronous proxy implement with http / socks5 in-bound and vmess out-bound, written in Rust and tokio Run example first, Fill out the

irumeria 7 Oct 3, 2022
An experimental HTTP server in Rust that supports HTTP/1.1, HTTP/2, and HTTP/3 over QUIC.

?? H123 An experimental HTTP server in Rust that supports HTTP/1.1, HTTP/2, and HTTP/3 over QUIC. Warning This is an experimental project and not inte

Naoki Ikeguchi 7 Dec 15, 2022
A TCP proxy using HTTP - Reach SSH behind a Nginx reverse proxy

?? TCP over HTTP ?? The Questions ?? What does it do? You can proxy TCP traffic over HTTP. A basic setup would be: [Your TCP target] <--TCP-- [Exit No

Julian 185 Dec 15, 2022
A high performence Socks5 proxy server with bind/reverse support implementation by Rust.

rsocx A high performence Socks5 proxy server with bind/reverse support implementation by Rust Features Async-std No unsafe code Single executable Linu

b23r0 259 Jan 6, 2023
Transforms UDP stream into (fake) TCP streams that can go through Layer 3 & Layer 4 (NAPT) firewalls/NATs.

Phantun A lightweight and fast UDP to TCP obfuscator. Table of Contents Phantun Latest release Overview Usage 1. Enable Kernel IP forwarding 2. Add re

Datong Sun 782 Dec 30, 2022
Proxy sentry request to a sentry server using a tunnel/proxy endpoint

Sentry Tunnel This is a proxy that forwards tunneled sentry requests to the real sentry server. The implementation is based on the explanation provide

Paul FLORENCE 14 Dec 20, 2022
Library + CLI-Tool to measure the TTFB (time to first byte) of HTTP requests. Additionally, this crate measures the times of DNS lookup, TCP connect and TLS handshake.

TTFB: CLI + Lib to Measure the TTFB of HTTP/1.1 Requests Similar to the network tab in Google Chrome or Mozilla Firefox, this crate helps you find the

Philipp Schuster 24 Dec 1, 2022