What's new

Manage NordVPN recommended servers through addons API page

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Last edited:
@Jack Yaz thank you for taking up this project! This script makes updating NordVPNServers very very easy!
I have successfully installed and will use/test it.
There is one thing that I had to do to get it working (not sure if it is written somewhere):
Before the script was able to detect my Nord-VPN-Client #1, I had to rename it in the GUI to "nordvpn". Then it was recognized, but not before. Maybe this would help others to get it working...
 
@Jack Yaz thank you for taking up this project! This script makes updating NordVPNServers very very easy!
I have successfully installed and will use/test it.
There is one thing that I had to do to get it working (not sure if it is written somewhere):
Before the script was able to detect my Nord-VPN-Client #1, I had to rename it in the GUI to "nordvpn". Then it was recognized, but not before. Maybe this would help others to get it working...
While it won't detect it as a NordVPN client without "NordVPN", any client can be set by the script.
 
Thanks Jack Yaz, works perfectly no issues. Another script you can't be without!
Keep up the good work. :)
 
I think this is at a point where people can give it a spin. Any and all feedback welcome!

Install using:
Code:
/usr/sbin/curl --retry 3 "https://raw.githubusercontent.com/jackyaz/nvpnmgr/master/nvpnmgr.sh" -o "/jffs/scripts/nvpnmgr" && chmod 0755 /jffs/scripts/nvpnmgr && /jffs/scripts/nvpnmgr install

README is here: https://github.com/jackyaz/nvpnmgr#nvpnmgr
Install was flawless, now I just need to time to play around with the configuration portion.
 
Works great here. Thank you [mention]Jack Yaz [/mention]!


Sent from my iPhone using Tapatalk
 
Any chance to make the choice selection of days easier? I had to think a bit what 0 meant early this AM[emoji6] (is it Mon or today).

Currently, when it asks for “what days of the week” to manage the VPN client you are presented with 0-6 as options. I selected, 0,2,4 and when I looked at the schedule, the following days were selected: Tue, Thu and Sunday (day 5?).

Wonder if we could try letters instead as selection choice for example: M, T, W, TH....

Just a thought...thank you!


Sent from my iPhone using Tapatalk
 
Not sure if this would be possible but here’s another fun challenge to consider Jack...

I have been watching the various VPN servers that this script selects every so often and have also been using the NVPN app to determine their geolocation.

So far all of them have been located in a state that closer to where I live but a bit further from another area servers that I prefer to use instead.

Example: I live in Iowa and I prefer using the Chicago servers as they are a lot closer to me....however, I only get selections of St.Louis servers which are quite further away instead.

I know NordVPN updates their servers every so often (that is why I use their app to determine which to choose) but wouldn’t it be great if the script could present you with various NVPN region selections to choose the best server from?

Thanks again!


Sent from my iPhone using Tapatalk
 
Any chance to make the choice selection of days easier? I had to think a bit what 0 meant early this AM[emoji6] (is it Mon or today).

Currently, when it asks for “what days of the week” to manage the VPN client you are presented with 0-6 as options. I selected, 0,2,4 and when I looked at the schedule, the following days were selected: Tue, Thu and Sunday (day 5?).

Wonder if we could try letters instead as selection choice for example: M, T, W, TH....

Just a thought...thank you!


Sent from my iPhone using Tapatalk
webui ;-) check the vpn section
 
Not sure if this would be possible but here’s another fun challenge to consider Jack...

I have been watching the various VPN servers that this script selects every so often and have also been using the NVPN app to determine their geolocation.

So far all of them have been located in a state that closer to where I live but a bit further from another area servers that I prefer to use instead.

Example: I live in Iowa and I prefer using the Chicago servers as they are a lot closer to me....however, I only get selections of St.Louis servers which are quite further away instead.

I know NordVPN updates their servers every so often (that is why I use their app to determine which to choose) but wouldn’t it be great if the script could present you with various NVPN region selections to choose the best server from?

Thanks again!


Sent from my iPhone using Tapatalk
we're limited to what the nordvpn api exposes. looks like country is the best you get:
upload_2020-6-23_13-12-43.png
 
following up, while i could display a list and you could pick, you run the risk of the vpn server going offline and you lose connectivity. the scheduled feature for picking the recommended server combats this.

Good to know. Thank you for following up with this!


Sent from my iPhone using Tapatalk
 
I have notice that after a update by nvpnmgr of the recommended VPN-server that "Automatic start at boot time" change to NO and "Accept DNS Configuration" change to Relax under the VPN-Client page. Have somebody seen this to?
If so is this something that can be undone in the script or make it selectable under NordVPN Manager page?
 
I have notice that after a update by nvpnmgr of the recommended VPN-server that "Automatic start at boot time" change to NO and "Accept DNS Configuration" change to Relax under the VPN-Client page. Have somebody seen this to?
If so is this something that can be undone in the script or make it selectable under NordVPN Manager page?
DNS should only change if you don't have an IP address specified for the client:
Code:
if [ -z "$(nvram get vpn_client"$VPN_NO"_addr)" ]; then
            nvram set vpn_client"$VPN_NO"_adns="3"
            nvram set vpn_client"$VPN_NO"_enforce="1"
        fi
start at boot isn't touched by the code - you can check which clients should start with the below
Code:
 nvram get vpn_clientx_eas
 
DNS should only change if you don't have an IP address specified for the client:
Code:
if [ -z "$(nvram get vpn_client"$VPN_NO"_addr)" ]; then
            nvram set vpn_client"$VPN_NO"_adns="3"
            nvram set vpn_client"$VPN_NO"_enforce="1"
        fi
start at boot isn't touched by the code - you can check which clients should start with the below
Code:
 nvram get vpn_clientx_eas

Ok, thanks for info. I will do some more testing.
 
Not sure if this would be possible but here’s another fun challenge to consider Jack...

I have been watching the various VPN servers that this script selects every so often and have also been using the NVPN app to determine their geolocation.

So far all of them have been located in a state that closer to where I live but a bit further from another area servers that I prefer to use instead.

Example: I live in Iowa and I prefer using the Chicago servers as they are a lot closer to me....however, I only get selections of St.Louis servers which are quite further away instead.

I know NordVPN updates their servers every so often (that is why I use their app to determine which to choose) but wouldn’t it be great if the script could present you with various NVPN region selections to choose the best server from?

You know what... This could be done!

Option 1. A hugely complex piece of work... the NordVPN api exposes the geolocation of each server. It would need the user to enter their geolocation into the config though (not sure I'd want to do this myself!). Using the current geolocation you could pull the recommended server from the top 5 closest ones and pick the top option.

Option 2. A less complex option (and less risky than storing a geolocation) might be to pull all countries and cities... Also possible through the api! It might be possible to apply a filter to the api call to only return recommendations for a particular country and city! List all available countries and cities:
curl -s -m 5 "https://api.nordvpn.com/v1/servers/countries" | jq --raw-output '.[] | . as $parent | .cities[] | [$parent.name, .name] | "\(.[0]) - \(.[1])"'
I'd need to figure out how to apply a filter to the api for "recommended" servers but I believe this is possible.
 
You know what... This could be done!

Option 1. A hugely complex piece of work... the NordVPN api exposes the geolocation of each server. It would need the user to enter their geolocation into the config though (not sure I'd want to do this myself!). Using the current geolocation you could pull the recommended server from the top 5 closest ones and pick the top option.

Option 2. A less complex option (and less risky than storing a geolocation) might be to pull all countries and cities... Also possible through the api! It might be possible to apply a filter to the api call to only return recommendations for a particular country and city! List all available countries and cities:
curl -s -m 5 "https://api.nordvpn.com/v1/servers/countries" | jq --raw-output '.[] | . as $parent | .cities[] | [$parent.name, .name] | "\(.[0]) - \(.[1])"'
I'd need to figure out how to apply a filter to the api for "recommended" servers but I believe this is possible.
option 2 could work, but it'd need a fallback to whatever nordvpn recommend if there are no servers in your chosen city/region

This link is quite handy: https://blog.sleeplessbeastie.eu/2019/02/18/how-to-use-public-nordvpn-api/
 
option 2 could work, but it'd need a fallback to whatever nordvpn recommend if there are no servers in your chosen city/region

This link is quite handy: https://blog.sleeplessbeastie.eu/2019/02/18/how-to-use-public-nordvpn-api/
@h0me5k1n looks like recommended api only accepts country_id as a filter, city doesn't seem to be possible.

we could write our own pseudo api, and measure "best" server by loading and/or ping response time. e.g. pull 5 recommended servers, fire off a 5-10s ping to each of them and use the lowest avg ping as "recommended". loading could be factored in - we'd need a sane scoring algorithm
 
Good point! Fallback checking could be done in the "getRecommended" function though so it wouldn't be a big change. I would start with "country+city" (if set) and fallback to "country only" on fail (and if set) and if that also fails fallback to the default recommendation ;)! Obviously, however the config is stored for the UI and how the UI automatically gets and displays the list of available countries and cities adds to the complexity of the solution.

This gets the recommended server for USA...
curl -s -m 5 "https://api.nordvpn.com/v1/servers/recommendations?filters\[servers_groups\]\[identifier\]=legacy_standard&filters\[servers_technologies\]\[identifier\]=openvpn_udp&filters\[country_id\]=228&limit=1"

Had to use country_id (228)! This gets all countries and cities with ids (that I don't know how to add to the filter on the "recommended" api):
curl -s -m 5 "https://api.nordvpn.com/v1/servers/countries" | jq --raw-output '.[] | . as $parent | .cities[] | [$parent.name, $parent.id, .name, .id] | "\(.[0]) id is \(.[1]) - \(.[2]) id is \(.[3])"'

The "city" MUST be filtered in the api call and not in the jq processing to be a true "recommendation" from NordVPN. Unless as @Jack Yaz suggests that we write our own check.

If the script could let you choose a city too - it would provide a greater capability than NordVPNs own "recommended server" page :)

EDIT - I think a large part of the NordVPN recommendation is the capacity of the server (how many connections are taken). I'm sure they recommend by the load on the server and not necessarily by ping... so writing some kind of pseudo recommendation might actually be a better idea!
 
Last edited:

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top