Rafficer / linux-cli-community

Linux command-line client for ProtonVPN. Written in Python.
https://protonvpn.com
GNU General Public License v3.0
1.31k stars 198 forks source link

Proxy Support for API Servers #237

Closed iiriix closed 2 years ago

iiriix commented 4 years ago

Problem: In some situations and countries, ProtonVPN API servers are not reachable due to the reason that they are blocked or filtered. This causes problem for the call_api() function, and as a result, protonvpn_cli doesn't work at all.

Solution: This pull requests adds support to configure a proxy to be used when calling ProtonVPN API servers. It'll be only used to call the API servers, and does not meant to establish VPN Connection through the provided proxy.

It also adds proxy support to the relevant functions calling call_api(), so, whenever it is needed, it can be disabled by passing proxy=False parameter. Moreover, it only uses the proxy when the user enables and configures the proxy, and when it's not connected to ProtonVPN (as API servers will be reachable when connected).

Changes:

Issues: Issues such as #97, #232, #234, #235 can be fixed with using a temporary proxy to fetch necessary data from ProtonVPN API servers.