9 stable releases

1.2.5 Feb 19, 2022
1.2.4 Dec 27, 2021
1.2.3 Oct 16, 2021
1.2.2 Aug 28, 2021
1.1.0 Jan 17, 2021

#4 in #client-connect

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

7,963 downloads per month
Used in 13 crates (10 directly)

BSD-3-Clause

20KB
268 lines

async-http-proxy

async-http-proxy is a lightweight asynchronous HTTP proxy client library, which can be used to connect a to a TCP port via HTTP Connect proxy. It can use Tokio and async-std as asynchronous runtime.

Latest version License Dependency status

Example

The following example shows how to connect to github.com via Connect proxy (tokio):

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

The following example shows how to connect to example.org with Basic Authentication via Connect proxy (async-std):

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

Features

  • HTTP CONNECT
  • Basic Auth
  • Tokio
  • async-std

License

This project is licensed under the BSD-3-Clause license.

Contribution

Any contribution intentionally submitted for inclusion in async_http_proxy by you, shall be licensed as BSD-3-Clause, without any additional terms or conditions.

Dependencies

~0.4–12MB
~128K SLoC