fix lookup

This commit is contained in:
2026-03-07 00:39:06 +01:00
parent 56ed5909c7
commit 2f16721a93
3 changed files with 52 additions and 14 deletions
+5 -1
View File
@@ -1,13 +1,17 @@
export const DnsService = {
async resolve(hostname: string): Promise<string | null> {
try {
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), 5000);
const response = await fetch(
`https://cloudflare-dns.com/dns-query?name=${hostname}&type=A`,
{
headers: { accept: 'application/dns-json' },
credentials: 'omit'
credentials: 'omit',
signal: controller.signal,
}
);
clearTimeout(timeout);
if (!response.ok) return null;