pub struct Proxy {
pub url: String,
pub status: ProxyStatus,
pub success_count: usize,
pub failure_count: usize,
pub last_check: Instant,
pub response_time: Option<f64>,
pub limiter: Arc<RateLimiter<NotKeyed, InMemoryState, DefaultClock, NoOpMiddleware>>,
}Expand description
Representation of a proxy server.
Fields§
§url: StringThe URL of the proxy (e.g. “socks5://127.0.0.1:1080”).
status: ProxyStatusThe current status of the proxy.
success_count: usizeNumber of successful requests made through this proxy.
failure_count: usizeNumber of failed requests made through this proxy.
last_check: InstantTime when this proxy was last checked.
response_time: Option<f64>Average response time in seconds, if available.
limiter: Arc<RateLimiter<NotKeyed, InMemoryState, DefaultClock, NoOpMiddleware>>Rate limiter to enforce minimum interval between requests.
Implementations§
Source§impl Proxy
impl Proxy
Sourcepub fn new(url: String, min_request_interval_ms: u64) -> Self
pub fn new(url: String, min_request_interval_ms: u64) -> Self
Create a new proxy with the given URL and rate limit.
Sourcepub fn to_reqwest_proxy(&self) -> Result<Proxy, Error>
pub fn to_reqwest_proxy(&self) -> Result<Proxy, Error>
Convert the proxy URL to a reqwest::Proxy.
Sourcepub fn success_rate(&self) -> f64
pub fn success_rate(&self) -> f64
Calculate the success rate of this proxy.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Proxy
impl RefUnwindSafe for Proxy
impl Send for Proxy
impl Sync for Proxy
impl Unpin for Proxy
impl UnsafeUnpin for Proxy
impl UnwindSafe for Proxy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more