fixes and cleanup

This commit is contained in:
Simon
2026-03-05 18:18:48 +00:00
parent 76fd5a4f4f
commit 2627505ade
49 changed files with 3245 additions and 1376 deletions

View File

@@ -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(),