2 个版本

使用旧的 Rust 2015

0.1.4 2024 年 3 月 14 日
0.1.3 2024 年 2 月 15 日
0.1.2 2024 年 1 月 21 日
0.1.1 2023 年 12 月 13 日
0.0.2 2023 年 6 月 3 日

#1198 in 网络编程

Download history 104/week @ 2024-03-20 101/week @ 2024-03-27 131/week @ 2024-04-03 115/week @ 2024-04-10 3/week @ 2024-04-17

267 每月下载量

MIT 许可证

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 对 HevSocks5Tunnel 的绑定

特性

  • IPv4/IPv6。 (双栈)
  • 重定向 TCP 连接。
  • 重定向 UDP 数据包。 (Fullcone NAT,UDP 在 UDP/TCP)
  • Linux/Android/FreeBSD/macOS/iOS。

基准测试

更多详情请见 这里

速度

CPU 使用率

内存使用率

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()

贡献者

许可证

MIT

无运行时依赖