fixes and cleanup
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use std::fmt;
|
||||
use std::sync::Arc;
|
||||
use std::str::FromStr;
|
||||
use std::sync::Arc;
|
||||
|
||||
use serde::Serialize;
|
||||
use tokio::sync::{OnceCell, RwLock};
|
||||
@@ -71,11 +71,7 @@ impl fmt::Display for Proxy {
|
||||
"{}://{}@{}:{}",
|
||||
self.protocol, username, self.host, self.port
|
||||
),
|
||||
(None, Some(_)) => write!(
|
||||
f,
|
||||
"{}://{}:{}",
|
||||
self.protocol, self.host, self.port
|
||||
),
|
||||
(None, Some(_)) => write!(f, "{}://{}:{}", self.protocol, self.host, self.port),
|
||||
(None, None) => write!(f, "{}://{}:{}", self.protocol, self.host, self.port),
|
||||
}
|
||||
}
|
||||
@@ -224,8 +220,7 @@ pub fn init_all_proxies_background(requester: Requester) {
|
||||
for list in PROXY_LIST {
|
||||
let proxy_cache = proxy_cache.clone();
|
||||
let mut requester = requester.clone();
|
||||
tasks
|
||||
.spawn(async move { fetch_proxies(&mut requester, list, proxy_cache).await });
|
||||
tasks.spawn(async move { fetch_proxies(&mut requester, list, proxy_cache).await });
|
||||
}
|
||||
|
||||
while let Some(result) = tasks.join_next().await {
|
||||
@@ -278,9 +273,7 @@ impl FromStr for Proxy {
|
||||
.ok_or_else(|| ProxyParseError::new("proxy url is missing host"))?
|
||||
.to_string();
|
||||
|
||||
let port = url
|
||||
.port()
|
||||
.unwrap_or(80);
|
||||
let port = url.port().unwrap_or(80);
|
||||
|
||||
Ok(Proxy {
|
||||
protocol: url.scheme().to_string(),
|
||||
|
||||
Reference in New Issue
Block a user