From 785b46b44359cd901572d30ab44a72e67ad8d55a Mon Sep 17 00:00:00 2001 From: Pynx Echaup <33941693+echaupynx@users.noreply.github.com> Date: Thu, 19 Jul 2018 15:30:02 +0200 Subject: [PATCH] dragfly: Added tool to select best server for the country Update start.sh as proposed by dragfly --- openvpn/start.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/openvpn/start.sh b/openvpn/start.sh index 6c8c6786b..7f5370ee9 100755 --- a/openvpn/start.sh +++ b/openvpn/start.sh @@ -13,6 +13,15 @@ fi echo "Using OpenVPN provider: ${OPENVPN_PROVIDER}" +if [[ "$OPENVPN_PROVIDER" = "NORDVPN" ]] +then + if [[ -z "$OPENVPN_CONFIG" ]] + then + export OPENVPN_CONFIG=$(curl -s 'https://nordvpn.com/wp-admin/admin-ajax.php?action=servers_recommendations' | jq -r '.[0].hostname').udp + echo "Setting best server ${OPENVPN_CONFIG}" + fi +fi + if [[ -n "${OPENVPN_CONFIG-}" ]]; then readarray -t OPENVPN_CONFIG_ARRAY <<< "${OPENVPN_CONFIG//,/$'\n'}" ## Trim leading and trailing spaces from all entries. Inefficient as all heck, but works like a champ.