ProtonVPN / linux-cli

Official ProtonVPN Linux app (CLI)
https://protonvpn.com/download-linux
GNU General Public License v3.0
332 stars 42 forks source link

Can we get a list of server numbers for my country in a file pls? #96

Closed valtoree closed 1 year ago

valtoree commented 1 year ago

Hi so I made a script to cycle through server number connecting. But I have to manually add the server numbers. Eg au#39, au#40, au#77 etc So where can I get a up to date server numbers for my country in a file pls? Thanks for reading.

neuron303 commented 1 year ago

I dug through the code of https://github.com/ProtonVPN/protonvpn-nm-lib for you, also because it is interesting to me and the server list is available via https://api.protonvpn.ch/vpn/logicals, but I would recommend you using protonvpn-nm-lib. What is the idea of the server rotation or why do you cycle through the servers?

valtoree commented 1 year ago

hi thanks for reply, why? well sometimes there are files i need and they are uploaded to file hosters that have a bandwidth limitation, like megaupload. So my script has 2 files, a list.txt (with server numbers, 30 31 32 etc) and another file with script to cycle connect the servers every time i run it. eg protonvpn-cli us#$number. I tried to find these servers numbers in the https://api.protonvpn.ch/vpn/logicals you gave me couldnt see them. Here is an extract on pastebin https://pastebin.com/GSNZUVVF. I also looked into https://github.com/ProtonVPN/protonvpn-nm-lib and also couldnt see anything. At the moment i have manually entered all the desired server numbers into my list.txt, i assume over time those numbers may change. It would be great to pull down a live server list when i needed to update. thanks again for your time.

neuron303 commented 1 year ago

@valtoree Ah so if I understand you correctly, you want to rotate the exit IP addresses to work around rate limiting.

Btw it is in there. Also in the file you put on pastebin. It is a json file. You need to look at the Name properties of the LogicalServers.

Following command extracts the full list curl --silent https://api.protonvpn.ch/vpn/logicals | jq ".LogicalServers | map(.Name)"

That would be easier to process using scripts.

There are other interesting properties in there like ExitIP and Load. Basically everything the app also needs. See curl --silent https://api.protonvpn.ch/vpn/logicals | jq ".LogicalServers | map(.Name,.Servers[0].ExitIP,.Load)"

valtoree commented 1 year ago

Your awesome. Got it now. Ty ty 🙇🙏 Didn't understand that the api was a json file and I could use it to get what I wanted. Another lesson to learn. You have solved my issue. You may close. Ty ty. Stay safe.