forked from Proxmox/proxmox
http: move rate-limiting out of client feature
this can now be used separately Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
b62d76e80c
commit
10a3ab222b
@ -30,6 +30,8 @@ proxmox-lang = { workspace = true, optional = true }
|
||||
[features]
|
||||
default = []
|
||||
|
||||
rate-limiter = ["dep:hyper"]
|
||||
rate-limited-stream = ["rate-limiter", "dep:tokio", "dep:hyper", "hyper?/client", "tokio?/time", "tokio?/net"]
|
||||
client = [ "dep:futures", "http-helpers", "dep:hyper", "hyper?/full", "dep:openssl", "dep:tokio", "tokio?/io-util", "dep:tokio-openssl" ]
|
||||
client-sync = [ "client-trait", "http-helpers", "dep:ureq" ]
|
||||
client-trait = [ "dep:http" ]
|
||||
|
@ -18,7 +18,7 @@ use crate::proxy_config::ProxyConfig;
|
||||
use crate::uri::build_authority;
|
||||
|
||||
use super::tls::MaybeTlsStream;
|
||||
use super::{RateLimitedStream, ShareableRateLimit};
|
||||
use crate::{RateLimitedStream, ShareableRateLimit};
|
||||
|
||||
type SharedRateLimit = Arc<dyn ShareableRateLimit>;
|
||||
|
||||
|
@ -8,16 +8,6 @@
|
||||
//!
|
||||
//! Both clients implement [`HttpClient`](crate::HttpClient) if the feature `client-trait` is enabled.
|
||||
|
||||
#[cfg(feature = "client")]
|
||||
mod rate_limiter;
|
||||
#[cfg(feature = "client")]
|
||||
pub use rate_limiter::{RateLimit, RateLimiter, RateLimiterVec, ShareableRateLimit};
|
||||
|
||||
#[cfg(feature = "client")]
|
||||
mod rate_limited_stream;
|
||||
#[cfg(feature = "client")]
|
||||
pub use rate_limited_stream::RateLimitedStream;
|
||||
|
||||
#[cfg(feature = "client")]
|
||||
mod connector;
|
||||
#[cfg(feature = "client")]
|
||||
|
@ -23,3 +23,13 @@ pub mod client;
|
||||
mod client_trait;
|
||||
#[cfg(feature = "client-trait")]
|
||||
pub use client_trait::HttpClient;
|
||||
|
||||
#[cfg(feature = "rate-limiter")]
|
||||
mod rate_limiter;
|
||||
#[cfg(feature = "rate-limiter")]
|
||||
pub use rate_limiter::{RateLimit, RateLimiter, RateLimiterVec, ShareableRateLimit};
|
||||
|
||||
#[cfg(feature = "rate-limited-stream")]
|
||||
mod rate_limited_stream;
|
||||
#[cfg(feature = "rate-limited-stream")]
|
||||
pub use rate_limited_stream::RateLimitedStream;
|
||||
|
@ -1,10 +1,10 @@
|
||||
use std::future::Future;
|
||||
use std::io::IoSlice;
|
||||
use std::marker::Unpin;
|
||||
use std::pin::Pin;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use futures::Future;
|
||||
use hyper::client::connect::{Connected, Connection};
|
||||
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
|
||||
use tokio::time::Sleep;
|
Loading…
Reference in New Issue
Block a user