9个稳定版本

1.2.5 2022年2月19日
1.2.4 2021年12月27日
1.2.3 2021年10月16日
1.2.2 2021年8月28日
1.1.0 2021年1月17日

#4 in #client-connect

Download history • Rust 包仓库 1068/week @ 2024-03-14 • Rust 包仓库 1150/week @ 2024-03-21 • Rust 包仓库 1690/week @ 2024-03-28 • Rust 包仓库 1374/week @ 2024-04-04 • Rust 包仓库 1126/week @ 2024-04-11 • Rust 包仓库 1525/week @ 2024-04-18 • Rust 包仓库 1409/week @ 2024-04-25 • Rust 包仓库 1287/week @ 2024-05-02 • Rust 包仓库 1482/week @ 2024-05-09 • Rust 包仓库 1584/week @ 2024-05-16 • Rust 包仓库 1328/week @ 2024-05-23 • Rust 包仓库 2787/week @ 2024-05-30 • Rust 包仓库 1867/week @ 2024-06-06 • Rust 包仓库 2233/week @ 2024-06-13 • Rust 包仓库 2123/week @ 2024-06-20 • Rust 包仓库 1527/week @ 2024-06-27 • Rust 包仓库

7,963 每月下载量
用于 13 个crate (10个直接使用)

BSD-3-Clause

20KB
268

async-http-proxy

async-http-proxy 是一个轻量级异步HTTP代理客户端库,可用于通过HTTP Connect代理连接到TCP端口。它可以使用 Tokioasync-std 作为异步运行时。

Latest version License Dependency status

示例

以下示例展示了如何通过Connect代理(tokio)连接到 github.com

use async_http_proxy::http_connect_tokio;
use std::error::Error;
use tokio::net::TcpStream;
// Features "runtime-tokio" have to be activated
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    let mut stream = TcpStream::connect("127.0.0.1:8080").await?;
    http_connect_tokio(&mut stream, "example.org", 443).await?;
    // stream is now connect to github.com
    Ok(())
}

以下示例展示了如何通过Connect代理(async-std)使用基本认证连接到 example.org

use async_http_proxy::http_connect_async_std_with_basic_auth;
use async_std::net::TcpStream;
use async_std::task;
use std::error::Error;
// Features "async-std-tokio" and "basic-auth" have to be activated
fn main() -> Result<(), Box<dyn Error>> {
    task::block_on(async {
        let mut stream = TcpStream::connect("127.0.0.1:8080").await?;
        http_connect_async_std_with_basic_auth(
            &mut stream,
            "example.org",
            443,
            "username",
            "password",
        )
        .await?;
        // stream is now connect to github.com
        Ok(())
    })
}

特性

  • HTTP CONNECT
  • 基本认证
  • Tokio
  • async-std

许可证

本项目受BSD-3-Clause许可证的许可。

贡献

您提交的任何有意包含在 async_http_proxy 中的贡献,均应按 BSD-3-Clause 许可,不附加任何额外的条款或条件。

依赖关系

~0.4–12MB
~128K SLoC