kboghe / NordVPN-switcher

Rotate between different NordVPN servers with ease. Works both on Linux and Windows without any required changes to your code!
https://pypi.org/project/nordvpn-switcher/
189 stars 51 forks source link

Problems with conection #12

Open tiago199988 opened 3 years ago

tiago199988 commented 3 years ago

Sometimes Nord gets stuck trying to conect. is there any way add like a timeout function. Like for example after 10 secounds if no conection is made retry to conect to a new server.

kboghe commented 3 years ago

Hi Tiago, thanks for using nordvpn-switcher. The thing is, there is a timeout built into the script right now, but for some reason it doesn't seem to work all that well for some people. I'll doublecheck the script and see what I can do!

tiago199988 commented 3 years ago

👍

jochenboele commented 3 years ago

Hi, I think i found the problem. But don't know how to solve it. Once you get an error while connecting it causes for some strange settings when you check nordvpn status: ~$ nordvpn status Status: Disconnected Current server: se424.nordvpn.com Country: Sweden City: Stockholm Your new IP: 91.132.138.203 Current technology: OpenVPN Current protocol: UDP Uptime: 2 minutes 35 seconds

It shows disconnected but also shows it is connected. When you do this normally it only shows: ~$ nordvpn status Status: Disconnected

I don't find a way to remove it from the nordvpn status. Doing another disconnect does not help.

marrakechi commented 2 years ago

Hi, I've made a code to manage this issue, @kboghe if you have time you can include it in nordvpn-switcher, the idea is simple, using the timeout command in Linux,


for _ in range(10):  
    connect_cmd = "timeout 10s nordvpn connect " + random.choice(countries)  
    os.system(connect_cmd)  
    vpnStatusOutput = subprocess.run(['nordvpn', 'status'], stdout=subprocess.PIPE).stdout.decode('utf-8')  
    if not "Disconnected" in vpnStatusOutput:  
        break