Skip to content

Commit

Permalink
Merge pull request #215 from jumpsmm7/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
jumpsmm7 authored Jun 11, 2021
2 parents 7a311e0 + 16d19b5 commit 9a6cdf4
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 6 deletions.
50 changes: 45 additions & 5 deletions installer
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
# | | | \| | (___ | | / \ | | | | | |__ | |__) | Current Maintainer: #
# | | | . ` |\___ \ | | / /\ \ | | | | | __| | _ / SomeWhereOverTheRainBow #
# _| |_| |\ |____) | | |/ ____ \| |____| |____| |____| | \ \ #
#|_____|_| \_|_____/ |_/_/ \_|______|______|______|_| \_\ v2.2.2 #
#|_____|_| \_|_____/ |_/_/ \_|______|______|______|_| \_\ v2.2.3 #
# #
########################################################################################################

DI_VERSION="v2.2.2"
DI_VERSION="v2.2.3"
readonly LATEST_URL="https://api.github.com/repos/jedisct1/dnscrypt-proxy/releases/latest"
readonly DNSCRYPT_VER="$(curl -sL "$LATEST_URL" | grep "tag_name" | head -1 | cut -d \" -f 4)"

Expand Down Expand Up @@ -1433,7 +1433,11 @@ static_chosen_manual () {
read -r SDNSSTAMP
elif [ "$ANOTHER" == "NO" ]; then
echo -e "$INFO You have finished static setup."
toml_gvars_prep server_names "\"[${STATICRESOLVER}, $RESOLVERS]\""
if [ "$ODOH_ENABLE" == "true" ]; then
toml_gvars_prep server_names "\"[${STATICRESOLVER}, $ORESOLVERS, $RESOLVERS]\""
elif [ "$ODOH_ENABLE" == "false" ]; then
toml_gvars_prep server_names "\"[${STATICRESOLVER}, $RESOLVERS]\""
fi
return
fi
fi
Expand All @@ -1459,15 +1463,21 @@ static_choose_manual_addition () {
if [ -z "$INDEX" ]; then
[ "$USE_IPV6" == "true" ] && USE_IPV6="NOMATCH" || USE_IPV6="6"
local RESOLVERS
toml_gvars_prep dnscrypt_servers true dnscrypt_ephemeral_keys true doh_servers true tls_disable_session_tickets true odoh_servers false require_dnssec false require_nolog false require_nofilter false
toml_gvars_prep dnscrypt_servers true dnscrypt_ephemeral_keys true doh_servers true tls_disable_session_tickets true require_dnssec false require_nolog false require_nofilter false
echo -e "$INFO Available DNS servers: "
INDEX=$(awk -v PATT="$USE_IPV6" '/^## / && ($0 !~ PATT)' $TARG_DIR/public-resolvers.md | wc -l)
awk -v PATT="$USE_IPV6" '/^## / && ($0 !~ PATT) {printf " "; printf ++i") "$2": "; getline; getline; print}' $TARG_DIR/public-resolvers.md
read_input_num "Please choose DNS server" 1 "$INDEX"
else
read_input_num "Please choose next DNS server or press n to stop" 1 "$INDEX" n
if [ $? -eq 1 ]; then
static_chosen_manual 0
read_yesno "Do you want to choose which ODoH servers to enable?" && ODOH_ENABLE=true || ODOH_ENABLE=false
if [ "$ODOH_ENABLE" == "true" ]; then
static_choose_odoh
elif [ "$ODOH_ENABLE" == "false" ]; then
toml_gvars_prep odoh_servers false
static_chosen_manual 0
fi
return
fi
fi
Expand All @@ -1485,6 +1495,36 @@ static_choose_manual_addition () {
static_choose_manual_addition "$INDEX"
}

static_choose_odoh () {
local INDEX=$1
if [ -z "$INDEX" ]; then
local ORESOLVERS
toml_gvars_prep odoh_servers true
echo -e "$INFO Available DNS servers: "
INDEX=$(awk -v PATT="odohrelay" '/^## / && ($0 !~ PATT)' $TARG_DIR/odoh.md | wc -l)
awk -v PATT="odohrelay" '/^## / && ($0 !~ PATT) {printf " "; printf ++i") "$2": "; getline; getline; print}' $TARG_DIR/odoh.md
read_input_num "Please choose DNS server." 1 "$INDEX"
else
read_input_num "Please choose next DNS server or press n to stop." 1 "$INDEX" n
if [ $? -eq 1 ]; then
static_chosen_manual 0
return
fi
fi
local OITEM
OITEM=$(awk -v INDEX="$CHOSEN" -v PATT="odohrelay" '/^## / && ($0 !~ PATT) {i++} i==INDEX {print $2;exit}' $TARG_DIR/odoh.md)
if [ "$(echo "$ORESOLVERS" | grep -F "'$OITEM'")" ]; then
echo -e "$INFO $OITEM is already set"
else
if [ "$ORESOLVERS" ]; then
ORESOLVERS="${ORESOLVERS%?}', '$OITEM'"
else
ORESOLVERS="'$OITEM'"
fi
fi
static_choose_odoh "$INDEX"
}

setup_dnscrypt () {
if [ ! -f $TOML_ORI ] || [ ! -f $TARG_DIR/dnscrypt-proxy ]; then
echo -e "$ERROR dnscrypt-proxy is not installed. Aborting..."
Expand Down
2 changes: 1 addition & 1 deletion installer.md5sum
Original file line number Diff line number Diff line change
@@ -1 +1 @@
28d01f817eaf8c95b087d50a14611541
29841cead713e17cb0e465205581567a

0 comments on commit 9a6cdf4

Please sign in to comment.