#[must_use]
#[allow(clippy::case_sensitive_file_extension_comparisons)]
pub fn validate_icon_domain(url: &str) -> bool {
let host = match url.split("://").nth(1).and_then(|s| s.split('/').next()) {
Some(h) => h.split(':').next().unwrap_or(h),
None => return false,
};
if let Ok(ip) = host.parse::<std::net::Ipv4Addr>() {
if ip.is_private() || ip.is_loopback() || ip.is_link_local() {
return false;
}
}
let lower = host.to_lowercase();
!(lower == "localhost"
|| lower.ends_with(".localhost")
|| lower.ends_with(".local")
|| lower == "0.0.0.0")
}