feat: add local DNS availability check and display in UI

This commit is contained in:
Ivan K
2025-03-21 14:47:20 +03:00
parent 023210e0f0
commit 1be31eaf59
2 changed files with 105 additions and 38 deletions

View File

@@ -2027,6 +2027,8 @@ check_dns_available() {
local dns_server=$(uci get podkop.main.dns_server 2>/dev/null)
local is_available=0
local status="unavailable"
local local_dns_working=0
local local_dns_status="unavailable"
if [ "$dns_type" = "doh" ]; then
# Different DoH providers use different endpoints and formats
@@ -2058,7 +2060,13 @@ check_dns_available() {
fi
fi
echo "{\"dns_type\":\"$dns_type\",\"dns_server\":\"$dns_server\",\"is_available\":$is_available,\"status\":\"$status\"}"
# Check if local DNS resolver is working
if nslookup -timeout=2 $TEST_DOMAIN 127.0.0.1 >/dev/null 2>&1; then
local_dns_working=1
local_dns_status="available"
fi
echo "{\"dns_type\":\"$dns_type\",\"dns_server\":\"$dns_server\",\"is_available\":$is_available,\"status\":\"$status\",\"local_dns_working\":$local_dns_working,\"local_dns_status\":\"$local_dns_status\"}"
}
sing_box_add_secure_dns_probe_domain() {