mirror of
https://github.com/skidoodle/hostinfo
synced 2026-04-28 01:27:36 +02:00
localhost failsafe
This commit is contained in:
@@ -1,5 +1,8 @@
|
|||||||
export const DnsService = {
|
export const DnsService = {
|
||||||
async resolve(hostname: string): Promise<string | null> {
|
async resolve(hostname: string): Promise<string | null> {
|
||||||
|
if (hostname === 'localhost' || hostname.endsWith('.local')) {
|
||||||
|
return '127.0.0.1';
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
const controller = new AbortController();
|
const controller = new AbortController();
|
||||||
const timeout = setTimeout(() => controller.abort(), 5000);
|
const timeout = setTimeout(() => controller.abort(), 5000);
|
||||||
|
|||||||
Reference in New Issue
Block a user