Use TXT queries, introduce switch-to*sh
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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}"
|
||||
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#! /bin/sh
|
||||
|
||||
. ./common.inc
|
||||
|
||||
[ -e "$DNSCRYPT_FILE" ] && exit 0
|
||||
|
||||
./set-dns-to-dhcp.sh
|
||||
@@ -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
|
||||
|
||||
Executable
+30
@@ -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
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user