fix: handle IPs, avoid wrong parent-domain lookups, cache whois results

- Bare IP addresses and non-domain hosts (localhost, IPv6) now return a
  null expiry instead of throwing, so they no longer spam error logs.
- Extract the registrable domain with tldts instead of walking up
  hostname labels, so a subdomain can never accidentally return its
  parent domain's expiry date.
- Cache WHOIS lookups per registrable domain (1h positive, 10min
  negative) so visiting details pages does not re-query the registry
  every time.

Addresses review feedback on #3834.
This commit is contained in:
colinjtsen2010 committed 2026-08-13 12:02:49 +08:00
1 parent e5959ca91d
commit 75516a220d
7 files changed
+160 -53

No files matched your search

@@ -82,7 +82,7 @@ class MonitorController implements IMonitorController {
msg: "Domain expiry retrieved successfully",
data: {
domain: domainExpiry.domain,
expiryDate: new Date(domainExpiry.expiryDate),
expiryDate: domainExpiry.expiryDate === null ? null : new Date(domainExpiry.expiryDate),
},
});
});