fix: remove IW4x CDNs

This commit is contained in:
alterware
2025-06-11 14:17:33 +02:00
parent 64084c6fe0
commit 7760cedd82
5 changed files with 14 additions and 58 deletions

View File

@@ -195,12 +195,8 @@ pub struct Hosts {
impl Hosts {
/// create new rated hosts instance
pub async fn new(use_iw4x_cdns: bool) -> Self {
let cdn_hosts = if use_iw4x_cdns {
crate::global::IW4X_CDN_HOSTS.to_vec()
} else {
crate::global::CDN_HOSTS.to_vec()
};
pub async fn new() -> Self {
let cdn_hosts = crate::global::CDN_HOSTS.to_vec();
let mut hosts = Hosts {
servers: cdn_hosts,
@@ -276,7 +272,7 @@ impl Hosts {
}
/// CDN rating function for --rate flag
pub async fn rate_cdns_and_display(use_iw4x_cdns: bool) {
pub async fn rate_cdns_and_display() {
use colored::Colorize;
let (asn, region_str) = crate::http::get_location_info().await;
@@ -293,11 +289,7 @@ pub async fn rate_cdns_and_display(use_iw4x_cdns: bool) {
println!("Rating CDNs...");
let cdn_hosts = if use_iw4x_cdns {
crate::global::IW4X_CDN_HOSTS.to_vec()
} else {
crate::global::CDN_HOSTS.to_vec()
};
let cdn_hosts = crate::global::CDN_HOSTS.to_vec();
let mut hosts = Hosts {
servers: cdn_hosts,

View File

@@ -19,11 +19,6 @@ pub const CDN_HOSTS: [Server; 2] = [
Server::new("us-cdn.alterware.ovh", Region::NorthAmerica),
];
pub const IW4X_CDN_HOSTS: [Server; 2] = [
Server::new("cdn.iw4x.dev", Region::Europe),
Server::new("cf-cdn.iw4x.dev", Region::Global),
];
pub const IP2ASN: &str = "https://ip2asn.getserve.rs/v1/as/ip/self";
pub static USER_AGENT: Lazy<String> = Lazy::new(|| {
@@ -87,12 +82,10 @@ pub static PREFIXES: Lazy<HashMap<&'static str, PrintPrefix>> = Lazy::new(|| {
])
});
pub async fn check_connectivity_and_rate_cdns(
use_iw4x_cdns: bool,
) -> Pin<Box<dyn Future<Output = bool> + Send>> {
pub async fn check_connectivity_and_rate_cdns() -> Pin<Box<dyn Future<Output = bool> + Send>> {
Box::pin(async move {
crate::println_info!("Initializing CDN rating system...");
let hosts = Hosts::new(use_iw4x_cdns).await;
let hosts = Hosts::new().await;
let best_cdn = hosts.get_master_url();
if let Some(cdn_url) = best_cdn {
@@ -135,7 +128,7 @@ pub fn check_connectivity(
}
}
} else {
check_connectivity_and_rate_cdns(false).await.await
check_connectivity_and_rate_cdns().await.await
}
})
}

View File

@@ -667,9 +667,7 @@ async fn main() {
println!(" --offline: Run in offline mode");
println!(" --skip-connectivity-check: Don't check connectivity");
println!(" --rate: Display CDN rating information and exit");
println!(
"\nExample:\n alterware-launcher.exe iw4x --bonus --pass \"-console -nointro\""
);
println!("\nExample:\n alterware-launcher.exe iw6 --pass \"-headless\"");
return;
}
@@ -705,7 +703,7 @@ async fn main() {
}
if arg_bool(&args, "--rate") {
cdn::rate_cdns_and_display(false).await;
cdn::rate_cdns_and_display().await;
return;
}
@@ -737,7 +735,7 @@ async fn main() {
if initial_cdn.is_some() {
cfg.offline = !global::check_connectivity(initial_cdn).await;
} else {
cfg.offline = !global::check_connectivity_and_rate_cdns(false).await.await;
cfg.offline = !global::check_connectivity_and_rate_cdns().await.await;
}
}