2 releases

Uses old Rust 2015

0.1.4 Mar 14, 2024
0.1.3 Feb 15, 2024
0.1.2 Jan 21, 2024
0.1.1 Dec 13, 2023
0.0.2 Jun 3, 2023

#1074 in Network programming

Download history 137/week @ 2024-02-12 25/week @ 2024-02-19 16/week @ 2024-02-26 210/week @ 2024-03-11 114/week @ 2024-03-18 97/week @ 2024-03-25 146/week @ 2024-04-01 106/week @ 2024-04-08 43/week @ 2024-04-15

395 downloads per month

MIT license

3MB
69K SLoC

C 69K SLoC // 0.2% comments Rust 245 SLoC // 0.0% comments GNU Style Assembly 222 SLoC // 0.4% comments Shell 97 SLoC // 0.0% comments

Tun2Socks

Rust bindings for HevSocks5Tunnel

Features

  • IPv4/IPv6. (dual stack)
  • Redirect TCP connections.
  • Redirect UDP packets. (Fullcone NAT, UDP in UDP/TCP)
  • Linux/Android/FreeBSD/macOS/iOS.

Benchmarks

See here for more details.

Speed

CPU usage

Memory usage

API

/// Start and run the socks5 tunnel, this function will blocks until the
/// quit() is called or an error occurs.
///
/// # Arguments
///
/// * `config_path` - config file path
/// * `tun_fd` - tunnel file descriptor
///
/// # Returns
///
/// Returns Ok(()) on successful, otherwise returns Err(r).
pub fn main_from_file(config_path: &Path, tun_fd: RawFd) -> Result<(), i32>

/// Start and run the socks5 tunnel, this function will blocks until the
/// quit() is called or an error occurs.
///
/// # Arguments
///
/// * `config_str` - config string
/// * `tun_fd` - tunnel file descriptor
///
/// # Returns
///
/// Returns Ok(()) on successful, otherwise returns Err(r).
pub fn main_from_str(config_str: &str, tun_fd: RawFd) -> Result<(), i32>

/// Stop the socks5 tunnel.
pub fn quit()

Contributors

License

MIT

No runtime deps