use reqwest::Client;
use std::sync::LazyLock;
use std::time::Duration;
pub static HTTP_CLIENT: LazyLock<Client> = LazyLock::new(|| {
Client::builder()
.pool_max_idle_per_host(100) .pool_idle_timeout(Duration::from_secs(90))
.timeout(Duration::from_secs(30))
.connect_timeout(Duration::from_secs(5)) .tcp_keepalive(Duration::from_secs(60))
.tcp_nodelay(true) .http2_adaptive_window(true) .http2_keep_alive_interval(Duration::from_secs(30))
.http2_keep_alive_timeout(Duration::from_secs(20))
.http2_keep_alive_while_idle(true)
.gzip(true)
.brotli(true)
.deflate(true)
.user_agent("Lectern/0.1.0 (Rust; async)")
.build()
.expect("Failed to build HTTP client")
});
pub fn get_client() -> &'static Client {
&HTTP_CLIENT
}