Chore: improve domai alive check [skip ci]

This commit is contained in:
SukkaW
2025-01-06 21:37:40 +08:00
parent 20aae1c817
commit 0590097b47
2 changed files with 27 additions and 10 deletions

View File

@@ -203,15 +203,13 @@ async function isApexDomainAlive(apexDomain: string): Promise<[string, boolean]>
return onDomainAlive(apexDomain);
}
console.log(picocolors.gray('[domain check]'), picocolors.gray('no NS records'), { domain: apexDomain });
let whois;
try {
whois = await getWhois(apexDomain);
} catch (e) {
console.log(picocolors.red('[domain dead]'), 'whois error', { domain: apexDomain }, e);
return onDomainDead(apexDomain);
return onDomainAlive(apexDomain);
}
if (process.env.DEBUG) {
@@ -224,7 +222,7 @@ async function isApexDomainAlive(apexDomain: string): Promise<[string, boolean]>
return onDomainAlive(apexDomain);
}
console.log(picocolors.red('[domain dead]'), 'whois not found', { domain: apexDomain, whoisError });
console.log(picocolors.red('[domain dead]'), 'whois not found', { domain: apexDomain, err: whoisError });
return onDomainDead(apexDomain);
}
@@ -241,7 +239,11 @@ const whoisNotFoundKeywordTest = createKeywordFilter([
'no matching record',
'no information available about domain name',
'not been registered',
'no match!!'
'no match!!',
'status: available',
' is free',
'no object found',
'nothing found'
]);
// whois server can redirect, so whoiser might/will get info from multiple whois servers