2 releases
0.1.1 | Mar 24, 2024 |
---|---|
0.1.0 | Mar 9, 2024 |
#6 in #bandwidth
71 downloads per month
11KB
253 lines
use bytes::Bytes;
use http_body_util::{BodyExt, Empty};
use hyper_rustls::{HttpsConnector, HttpsConnectorBuilder};
use hyper_util::client::legacy::connect::HttpConnector;
use hyper_util::client::legacy::Client;
use hyper_util::rt::{TokioExecutor, TokioTimer};
let mut connector = HttpConnector::new();
connector.enforce_http(false);
let connector = hyper_throttle::Connector::builder(TokioTimer::new())
.read_rate(65536) // 64 KiB/s
.build(connector);
let connector = HttpsConnectorBuilder::new()
.with_native_roots()?
.https_or_http()
.enable_all_versions()
.wrap_connector(connector);
let client = Client::builder(TokioExecutor::new()).build::<_, Empty<Bytes>>(connector);
Dependencies
~3–12MB
~124K SLoC