NordVPN On Demand

After resolving an issue with the default.ovpn symlink, it was bugging me that each time the container ran it would download all of the NordVPN configs. After a bit of research I found a url where I could download just one ovpn file. A bit of rework and now only downloads the applicable config based off of NordVPNs api. No more 4000+ configs.

User can configure this using either NORDVPN_COUNTRY to connect to the best server in that country or a specific config using the OPENVPN_CONFIG parameter. If neither are specified config will be selected based off of NordVPN api and if both are specified it will connect to OPENVPN_CONFIG server first using the api to decide on a backup 'default.ovpn' config in case it fails.

In my rewriting of this I also realised there was no need for the updateConfigs.sh script anymore, but to keep everything in keeping I replaced the contents of the updateConfigs.sh script with the NordVPN_selector one and removed the latter.
This commit is contained in:
Tom Humphrey
2019-03-26 17:02:11 +00:00
parent aaab2f0155
commit ca99395250
9808 changed files with 139 additions and 832076 deletions

View File

@@ -31,12 +31,25 @@ fi
if [[ "${OPENVPN_PROVIDER^^}" = "NORDVPN" ]]
then
if [[ -z "$OPENVPN_CONFIG" ]]
if [[ -z $NORDVPN_PROTOCOL ]]
then
# Update config files
. ${VPN_PROVIDER_CONFIGS}/updateConfigs.sh
export OPENVPN_CONFIG=$(${VPN_PROVIDER_CONFIGS}/NordVPN_Server_Selector.sh)
echo "Setting best server ${OPENVPN_CONFIG}"
export NORDVPN_PROTOCOL=UDP
fi
if [[ -z $NORDVPN_CATEGORY ]]
then
export NORDVPN_CATEGORY=P2P
fi
if [[ ! -z $OPENVPN_CONFIG ]]
then
export NORDVPN_CATEGORY="${OPENVPN_CONFIG##*.^^}"
${VPN_PROVIDER_CONFIGS}/updateConfigs.sh --openvpn-config
elif [[ ! -z $NORDVPN_COUNTRY ]]
then
export OPENVPN_CONFIG=$(${VPN_PROVIDER_CONFIGS}/updateConfigs.sh)
else
export OPENVPN_CONFIG=$(${VPN_PROVIDER_CONFIGS}/updateConfigs.sh --get-recommended})
fi
fi