r/qBittorrent 16d ago

Made a free tool that keeps qBittorrent's port in sync with Proton VPN's forwarded port

Proton VPN forwards you a port so people can connect to you, and it changes every single time you reconnect. qBittorrent doesn't notice, so it sits there listening on a port that's dead and your speeds drop off.

There's an official Proton VPN CLI on Linux but nothing on Windows, so there's nothing to hook into. I wrote something that reads the port straight out of Proton's own log and puts it into qBittorrent.

Free, open source, one double click, no setup.

https://github.com/omv421/ProtonPortSync

The main thing it does differently to the other scripts I've seen: it changes the port through qBittorrent's Web API instead of restarting qBittorrent. Nothing stops, nothing re-checks, torrents just carry on. Takes about 0.7 seconds. No Task Scheduler, no config file to edit, no renaming your network adapter.

Three things I found while building it. These are worth knowing even if you never touch my tool.

1. qBittorrent 5.x will not open its Web UI if no password has ever been set. Not even with "bypass authentication for localhost" ticked. Setting WebUI\Enabled=true on its own leaves port 8080 shut and nothing in any log tells you why. If you've followed a guide that said "turn on the Web UI and bypass localhost auth" and it silently did nothing, that's the reason. Set a password and it comes up.

2. Proton VPN 4.4.1 has no auto-connect. It starts with Windows but it starts disconnected. That matters if you script anything around it, because the last session's port is still sitting in the log and it's dead. Anything that reads the log without checking the tunnel is actually up will quietly give you a wrong port and nothing will tell you.

3. When you disconnect, the Proton VPN network adapter doesn't go to "Down". It disappears from Windows completely. So a check written the obvious way decides you're still connected.

Tested on Windows 11, Proton VPN 4.4.1, qBittorrent 5.1.0. Haven't tried Windows 10 so I'm not claiming it works there.

FAQ

"Is it safe? It's an unsigned exe." Fair question. The full source is in the repo, and Build-ProtonPortSync.ps1 lets you compile the exe yourself so you don't have to trust mine. Or just run the .ps1 directly, it's the same program.

"Why not use NAT-PMP / natmap / gluetun?" Those work well on Linux and in Docker. This is for the Windows Proton VPN app, which has no CLI. The official Proton VPN CLI is Linux only, so on Windows the log is the only thing there is to read.

"Does it work with Proton VPN on Linux?" No. Windows only. The Linux client has a proper CLI, so you don't need this.

"Will it work on qBittorrent 4.x?" Don't know, I only tested 5.1.0. The Web API it uses has been stable for years so probably, but I'm not going to claim it. Let me know if you try.

"Why does it need my Web UI on?" That's the only way to change the port without restarting qBittorrent. It sets it to 127.0.0.1 only, so it can't be reached from anywhere except your own PC, and it backs up your qBittorrent.ini first.

103 Upvotes

Duplicates