aboutsummaryrefslogtreecommitdiff
path: root/src/lookup.rs
diff options
context:
space:
mode:
authorUMTS at Teleco <crt@teleco.ch>2026-03-08 23:27:14 +0100
committerUMTS at Teleco <crt@teleco.ch>2026-03-08 23:27:14 +0100
commit4b211599ee41f8d77ff240337582c178289fd222 (patch)
treec5f119a7f22313d3c13e3e642fbddf10549cf4f4 /src/lookup.rs
parent249d6f5b37d2a2ea6d78127b6d3a71e81f7bb7a3 (diff)
fix fix fix
Diffstat (limited to 'src/lookup.rs')
-rw-r--r--src/lookup.rs51
1 files changed, 26 insertions, 25 deletions
diff --git a/src/lookup.rs b/src/lookup.rs
index 694f559..2f73395 100644
--- a/src/lookup.rs
+++ b/src/lookup.rs
@@ -191,12 +191,12 @@ pub async fn lookup_domain(
eprintln!("[verbose] {} -> HTTP {}", full, status_code);
}
- // 404 = not found in RDAP = domain is available (not registered)
+ // 404 = not found in RDAP = domain is available (not registered) <- todo : should add check for "not found" in response body for extra safety as some registries return 404 for other errors too as was discovered
if status_code == 404 {
return DomainResult::new(name, tld, DomainStatus::Available);
}
- // 400 = probably invalid query
+ // 400 = probably invalid query fuck you
if status_code == 400 {
return DomainResult::new(
name,
@@ -208,7 +208,7 @@ pub async fn lookup_domain(
);
}
- // 429 = rate limited
+ // 429 = rape limited
if status_code == 429 {
return DomainResult::new(
name,
@@ -220,7 +220,7 @@ pub async fn lookup_domain(
);
}
- // 403 = forbidden (some registries block queries)
+ // 403 = forbidden crap
if status_code == 403 {
return DomainResult::new(
name,
@@ -244,7 +244,7 @@ pub async fn lookup_domain(
);
}
- // 200 = domain exists, try to parse expiry from RDAP json
+ // 200 = domain exists try to parse expiry from RDAP json
let expiry = match resp.json::<serde_json::Value>().await {
Ok(json) => extract_expiry(&json),
Err(_) => None,
@@ -270,7 +270,7 @@ fn extract_expiry(json: &serde_json::Value) -> Option<String> {
None
}
-// ---- WHOIS fallback for TLDs not in RDAP bootstrap ----
+// ---- WHOIS fallback for TLDs not in RDAP bootstrap because their shit ----
// -- No whois feature: just return an error --
#[cfg(not(any(feature = "system-whois", feature = "builtin-whois")))]
@@ -285,7 +285,7 @@ async fn whois_lookup(
tld,
DomainStatus::Error {
kind: ErrorKind::InvalidTld,
- message: "no RDAP server (whois disabled)".to_string(),
+ message: "no RDAP server (whois gone)".to_string(),
},
)
}
@@ -333,7 +333,7 @@ async fn whois_lookup(
tld,
DomainStatus::Error {
kind: ErrorKind::Unknown,
- message: format!("whois command failed: {}", e),
+ message: format!("whois command fucking failed: {}", e),
},
);
}
@@ -367,7 +367,7 @@ async fn whois_lookup(
if verbose {
eprintln!("[verbose] whois stderr: {}", stderr.trim());
}
- // some whois commands exit non-zero for "not found" but still give useful stdout
+ // some whois commands exit non zero for "not found" ... but may toss some infos to stdrr
if !response_str.is_empty() {
return parse_whois_response(name, tld, &response_str);
}
@@ -384,11 +384,11 @@ async fn whois_lookup(
parse_whois_response(name, tld, &response_str)
}
-// -- Builtin whois: rawdogs whois server violently over TCP directly--
+// -- Builtin whois Violator : rawdogs whois server violently over TCP directly --
-/// try a whois server returns the response string or errors out
+/// try a whois server if no happy it make error
#[cfg(feature = "builtin-whois")]
async fn try_whois_server(
server: &str,
@@ -425,7 +425,7 @@ async fn try_whois_server(
Ok(String::from_utf8_lossy(&response).to_string())
}
-/// candidate whois servers for a TLD based on common naming patterns
+/// try voilating some commonly used whois url patterns if unhappy
#[cfg(feature = "builtin-whois")]
fn whois_candidates(tld: &str) -> Vec<String> {
// most registries follow one of these patterns
@@ -445,7 +445,7 @@ async fn whois_lookup(
) -> DomainResult {
let full = format!("{}.{}", name, tld);
- // if Lists.toml has an explicit server ("tld:server"), use ONLY that one
+ // if Lists.toml has an explicit server ("tld:server"), use ONLY that one.
if let Some(server) = whois_overrides.get_server(tld) {
if verbose {
eprintln!("[verbose] WHOIS (override): {} -> {}", full, server);
@@ -475,12 +475,12 @@ async fn whois_lookup(
};
}
- // no override: try common server patterns until one responds
+ // no override: try common server patterns until one screams in pain from being violated hard
let candidates = whois_candidates(tld);
if verbose {
eprintln!(
- "[verbose] WHOIS probing {} candidates for .{}",
+ "[verbose] WHOIS voilating {} candidates for .{}",
candidates.len(),
tld
);
@@ -510,7 +510,7 @@ async fn whois_lookup(
tld,
DomainStatus::Error {
kind: ErrorKind::Unknown,
- message: "no whois server reachable".to_string(),
+ message: "unsuccessful whois rawdoging".to_string(),
},
)
}
@@ -566,15 +566,15 @@ fn extract_whois_expiry(response: &str) -> Option<String> {
for pattern in &expiry_patterns {
if trimmed.starts_with(pattern) {
let value = trimmed[pattern.len()..].trim();
- // try to extract a date-looking thing (first 10 chars if it looks like YYYY-MM-DD)
+ // horribly attempt at extracting date part
if value.len() >= 10 {
let date_part: String = value.chars().take(10).collect();
- // basic sanity check: contains digits and dashes
+ // basic sanity check does it actually contain any fucking digits and dashes
if date_part.contains('-') && date_part.chars().any(|c| c.is_ascii_digit()) {
return Some(date_part);
}
}
- // maybe its in a different format, just return what we got
+ // no clean date ? no problem just rawdog the user then MUAHAHHAHAHA
if !value.is_empty() {
return Some(value.to_string());
}
@@ -607,7 +607,7 @@ pub async fn lookup_with_retry(
if noretry.contains(kind) {
if verbose {
eprintln!(
- "[verbose] Not retrying {}.{} (error kind in noretry list)",
+ "[verbose] Not retrying {}.{} (config))",
name, tld
);
}
@@ -616,7 +616,7 @@ pub async fn lookup_with_retry(
}
if verbose {
eprintln!(
- "[verbose] Retry {}/{} for {}.{}",
+ "[verbose] Attempt to rawdog {}/{} for {}.{}",
attempt, retries, name, tld
);
}
@@ -772,6 +772,7 @@ async fn resolve_bootstrap(
None
};
+ // should make sure that if caching is on and cache expired we dont delete it until we successfully fetch the new content todo
match cached {
Some(b) => Some(b),
None => match RdapBootstrap::fetch(client, verbose).await {
@@ -779,17 +780,17 @@ async fn resolve_bootstrap(
if let Some(cp) = cache_path {
if let Err(e) = b.save_cache(cp) {
if verbose {
- eprintln!("[verbose] Failed to save cache: {}", e);
+ eprintln!("[verbose] Failed to save fucking cache: {}", e);
}
} else if verbose {
- eprintln!("[verbose] RDAP bootstrap cached to {}", cp.display());
+ eprintln!("[verbose] RDAP cached to {}", cp.display());
}
}
Some(b)
}
Err(e) => {
eprintln!("Error: {}", e);
- eprintln!("Cannot perform lookups without RDAP bootstrap data.");
+ eprintln!("Cannot perform lookups without RDAP data.");
None
}
},
@@ -816,7 +817,7 @@ pub struct LookupStream {
pub type LookupBatch = Vec<(String, Vec<String>)>;
-// spawns a bg task, sends results via channel so TUI gets em live
+// spawns a bg task then sends results via channel so TUI gets em live
pub fn lookup_streaming(
name: String,
tlds: Vec<String>,