Use TXT queries, introduce switch-to*sh

This commit is contained in:
Frank Denis
2012-07-31 18:50:06 -07:00
parent 7a78f8de10
commit 64d76e3dbb
7 changed files with 47 additions and 35 deletions
+2 -2
View File
@@ -4,10 +4,10 @@
touch "${STATES_DIR}/updating"
if [ -e "$DNSCRYPT_FILE" ]; then
./switch-to-dnscrypt.sh
./switch-to-dnscrypt-if-required.sh
else
./stop-dnscrypt-proxy.sh
./switch-to-dhcp.sh
./switch-to-dhcp-if-required-.sh
fi
rm -f "${STATES_DIR}/updating"
rm -f "${STATES_DIR}/update-request"
+1 -1
View File
@@ -8,4 +8,4 @@ FALLBACK_FILE="${CONTROL_DIR}/fallback"
./check-network-change.sh || exit 0
./set-dns-to-dhcp.sh
[ ! -e "$DNSCRYPT_FILE" ] && exit 0
./switch-to-dnscrypt.sh
./switch-to-dnscrypt-if-required.sh
+2 -2
View File
@@ -30,8 +30,8 @@ try_resolver() {
case "$line" in
*Proxying\ from\ *)
answers=$(exec dig +time=1 +short +tries=2 -p $priority \
@"$INTERFACE_PROBES" dailymotion.com 2> /dev/null | \
fgrep -v 67.215.65. | wc -l)
TXT @"$INTERFACE_PROBES" debug.opendns.com. 2> /dev/null | \
fgrep -ic 'dnscrypt enabled')
[ -r "$pid_file" ] && kill $(cat -- "$pid_file")
if [ $answers -gt 0 ]; then
echo "$args" > "${RES_DIR}/${priority}"
+7
View File
@@ -0,0 +1,7 @@
#! /bin/sh
. ./common.inc
[ -e "$DNSCRYPT_FILE" ] && exit 0
./set-dns-to-dhcp.sh
+2 -3
View File
@@ -2,6 +2,5 @@
. ./common.inc
[ -e "$DNSCRYPT_FILE" ] && exit 0
./set-dns-to-dhcp.sh
rm -f "$DNSCRYPT_FILE"
exec ./switch-to-dhcp-if-required.sh
+30
View File
@@ -0,0 +1,30 @@
#! /bin/ksh
. ./common.inc
PAUSE_MAX=10
PAUSE_INCREMENT=0.1
[ ! -e "$DNSCRYPT_FILE" ] && exit 0
pause=0
while :; do
if [ $pause -lt $PAUSE_MAX ]; then
pause=$((pause + $PAUSE_INCREMENT))
fi
sleep $pause
./check-hijacking.sh || continue
./start-dnscrypt-proxy.sh || continue
./check-local-dns.sh || continue
./set-dns.sh "$INTERFACE_PROXY"
if [ $? != 0 ]; then
./set-dns-to-dhcp.sh
continue
fi
./check-hijacking.sh
if [ $? != 0 ]; then
./set-dns-to-dhcp.sh
continue
fi
break
done
+3 -27
View File
@@ -1,30 +1,6 @@
#! /bin/ksh
#! /bin/sh
. ./common.inc
PAUSE_MAX=10
PAUSE_INCREMENT=0.1
[ ! -e "$DNSCRYPT_FILE" ] && exit 0
pause=0
while :; do
if [ $pause -lt $PAUSE_MAX ]; then
pause=$((pause + $PAUSE_INCREMENT))
fi
sleep $pause
./check-hijacking.sh || continue
./start-dnscrypt-proxy.sh || continue
./check-local-dns.sh || continue
./set-dns.sh "$INTERFACE_PROXY"
if [ $? != 0 ]; then
./set-dns-to-dhcp.sh
continue
fi
./check-hijacking.sh
if [ $? != 0 ]; then
./set-dns-to-dhcp.sh
continue
fi
break
done
touch "$DNSCRYPT_FILE"
exec ./switch-to-dnscrypt-if-required.sh