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

+4 -1
View File
@@ -152,7 +152,10 @@ registry.registerPath({
summary: "Get domain registration expiry for a monitor",
security: bearer,
request: { params: getDomainParamValidation },
responses: { "200": okJson(z.object({ domain: z.string(), expiryDate: z.string() })), ...standardErrors },
responses: {
"200": okJson(z.object({ domain: z.string().nullable(), expiryDate: z.string().nullable() })),
...standardErrors,
},
});
registry.registerPath({