luci-app-mosdns/root/usr/share/mosdns/dns.sh
2022-04-09 09:32:06 +08:00

17 lines
353 B
Bash
Executable File

#!/bin/bash -e
# shellcheck source=/etc/mosdns/library.sh
source /usr/share/mosdns/library.sh
if [ "$(ifconfig | grep -c wan)" = 0 ]; then
bakdns "$1"
exit 0
fi
if [[ "$(getdns 0)" =~ ^127\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
getdns "$1" inactive
elif [[ "$(getdns "$1")" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
getdns "$1"
else
bakdns "$1"
fi