mirror of
https://github.com/itdoginfo/podkop.git
synced 2025-12-08 04:26:55 +03:00
Merge pull request #73 from itdoginfo/feature/no-more-cache
🐛 fix(doh): Improve DoH server compatibility detection for quad9
This commit is contained in:
@@ -2038,23 +2038,25 @@ check_dns_available() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$dns_type" = "doh" ]; then
|
if [ "$dns_type" = "doh" ]; then
|
||||||
# Different DoH providers use different endpoints and formats
|
|
||||||
local result=""
|
local result=""
|
||||||
|
|
||||||
# Try common DoH endpoints and check for valid responses
|
if echo "$dns_server" | grep -q "quad9.net" || \
|
||||||
# First try /dns-query endpoint (Cloudflare, AdGuard DNS, etc.)
|
echo "$dns_server" | grep -qE "^9\.9\.9\.(9|10|11)$|^149\.112\.112\.(112|10|11)$|^2620:fe::(fe|9|10|11)$|^2620:fe::fe:(10|11)$"; then
|
||||||
|
result=$(curl --connect-timeout 5 -s -H "accept: application/dns-json" "https://$dns_server:5053/dns-query?name=itdog.info&type=A")
|
||||||
|
else
|
||||||
result=$(curl --connect-timeout 5 -s -H "accept: application/dns-json" "https://$dns_server/dns-query?name=itdog.info&type=A")
|
result=$(curl --connect-timeout 5 -s -H "accept: application/dns-json" "https://$dns_server/dns-query?name=itdog.info&type=A")
|
||||||
if [ $? -eq 0 ] && echo "$result" | grep -q "data"; then
|
if [ $? -eq 0 ] && echo "$result" | grep -q "data"; then
|
||||||
is_available=1
|
is_available=1
|
||||||
status="available"
|
status="available"
|
||||||
else
|
else
|
||||||
# If that fails, try /resolve endpoint (Google DNS)
|
|
||||||
result=$(curl --connect-timeout 5 -s -H "accept: application/dns-json" "https://$dns_server/resolve?name=itdog.info&type=A")
|
result=$(curl --connect-timeout 5 -s -H "accept: application/dns-json" "https://$dns_server/resolve?name=itdog.info&type=A")
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $? -eq 0 ] && echo "$result" | grep -q "data"; then
|
if [ $? -eq 0 ] && echo "$result" | grep -q "data"; then
|
||||||
is_available=1
|
is_available=1
|
||||||
status="available"
|
status="available"
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
elif [ "$dns_type" = "dot" ]; then
|
elif [ "$dns_type" = "dot" ]; then
|
||||||
(nc "$dns_server" 853 </dev/null >/dev/null 2>&1) & pid=$!
|
(nc "$dns_server" 853 </dev/null >/dev/null 2>&1) & pid=$!
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|||||||
Reference in New Issue
Block a user