10 个版本

新版本 0.3.4 2024 年 8 月 18 日
0.3.3 2024 年 8 月 18 日
0.2.2 2024 年 6 月 19 日
0.1.1 2024 年 6 月 15 日
0.1.0 2024 年 5 月 16 日

1955网络编程

Download history 83/week @ 2024-05-10 57/week @ 2024-05-17 10/week @ 2024-05-24 4/week @ 2024-05-31 2/week @ 2024-06-07 654/week @ 2024-06-14 55/week @ 2024-06-21 2/week @ 2024-06-28 7/week @ 2024-07-05 12/week @ 2024-07-26 1/week @ 2024-08-02 527/week @ 2024-08-16

每月 540 次下载
socky 中使用

MIT 许可证

21KB
409

Proxied

Rust 的异步 SOCKS4/5 和 HTTP(s) 客户端连接器

功能

  • HTTP/HTTPS 代理
  • SOCKS4/5 代理
  • 每种代理的基本认证
  • 完全 异步
  • 代理地址作为 DNS 名称
  • 多个地址时的轮询调度

入门指南

将以下内容添加到您的 Cargo.toml 文件中

[dependencies]
proxied = "0.3"

示例

use proxied::{Proxy, TCPConnection, NetworkTarget};

#[tokio::main]
async fn main() {
    let proxy = Proxy::from_str("socks5://127.0.0.1:1080").unwrap();
    let connection = proxy.connect(NetworkTarget::Domain {domain: "tcpbin.com", port: 4242}).await.unwrap();

    // Send data to the echo server
    let data = &[1, 2, 3, 4, 5, 6, 7, 8, 9];
    connection.write(data).await.unwrap(); 

    // Read the data back
    let mut buf = vec![0; data.len()];
    connection.read_exact(&mut buf).await.unwrap();

}

lib.rs:

Proxied

异步代理 TCP 连接器

包含

  • unsafe 代码
  • 支持 SOCKS4/5 和 HTTP(s) 代理
  • 两种代理类型的单一结构
  • TCPStream-like 连接(请参阅 TCPConnection
  • 密码认证

如何使用

主入口点是 Proxy 结构。它包含有关代理的连接数据,如协议、地址端口和凭据。此外,它还支持 IP 刷新链接,尽管用户需要手动请求。

要创建 TCP 连接,请调用 Proxy::connect_tcp。创建后,它可以像常规 TCP 流一样使用,因为它实现了 AsyncReadAsyncWrite

依赖关系

~4–12MB
~131K SLoC