6个版本 (重大变更)
0.4.0 | 2022年4月8日 |
---|---|
0.3.0 | 2021年1月19日 |
0.2.0 | 2020年2月29日 |
0.1.0 | 2019年3月31日 |
0.0.2 | 2019年3月29日 |
在HTTP客户端中排名第552
11KB
89 行
hyper-trust-dns-connector
一个crate,使trust-dns-resolver的异步解析器与hyper客户端兼容,以代替默认的 DNS 线程池。
动机
默认情况下,hyper HttpConnector 使用 std 提供的解析器,该解析器在具有可配置线程数的线程池中是阻塞的。此crate提供了一种替代方案,使用 trust_dns_resolver,这是用 Rust 编写的具有异步功能的 DNS 解析器。
示例
use hyper::{Body, Client};
use hyper_trust_dns_connector::new_async_http_connector;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let http = new_async_http_connector()?;
let client = Client::builder().build::<_, Body>(http);
let status_code = client
.get(hyper::Uri::from_static("http://httpbin.org/ip"))
.await?
.status();
assert_eq!(status_code, 200);
Ok(())
}
贡献
如果您需要实现功能或想帮忙,请毫不犹豫地打开一个问题或一个PR。
许可证
在MIT许可证下提供(LICENSE或http://opensource.org/licenses/MIT)
依赖项
~10–24MB
~338K SLoC