Pick a random resolver if none was configured

This commit is contained in:
Alter Step
2015-06-09 22:17:30 +02:00
parent 1c3184a36e
commit 121feecdf7
3 changed files with 10 additions and 4 deletions
@@ -39,8 +39,6 @@ RESOLVERS_UPDATES_BASE_URL="http://download.dnscrypt.org/dnscrypt-proxy"
RESOLVERS_LIST_BASE_DIR="/usr/local/share/dnscrypt-proxy"
RESOLVERS_LIST_PUBLIC_KEY="RWQf6LRCGA9i53mlYecO4IzT51TGPpvWucNSCh1CBM0QTaLn73Y7GFO3"
DEFAULT_RESOLVER_NAME='opendns'
INTERFACE_UNBOUND="127.0.0.53"
INTERFACE_UNBOUND_MASK="24"
INTERFACE_PROXY="127.0.0.54"
@@ -4,5 +4,5 @@
[ -r "$DNSCRYPT_RESOLVER_NAME_FILE" ] && \
sed 's/[^a-zA-Z0-9.-]/_/g' < "$DNSCRYPT_RESOLVER_NAME_FILE" && exit 0
echo "$DEFAULT_RESOLVER_NAME"
exit 0
exec ./get-random-resolver.sh
@@ -0,0 +1,8 @@
#! /bin/sh
. ./common.inc
(read header; fgrep -v :: | cut -d, -f1 | egrep -v '^\s*$') \
< "${RESOLVERS_LIST_BASE_DIR}/dnscrypt-resolvers.csv" | \
perl -MList::Util=shuffle -e 'print shuffle(<STDIN>);' | \
head -n1