Releases: kgillibrand/PIA-Port-Forwarding-Script
Releases · kgillibrand/PIA-Port-Forwarding-Script
v1.3.0: New API from PIA
v1.3.0: New API from PIA
- Uses a new API endpoint released by PIA
- Only a client id is needed and it is randomly generated. No more config file needed
- The API tends to not return a response or reset connections if you use an unsupported gateway or try to port forward twice unfortunately
v1.2.0: Minor changes
Minor changes
- The response encoding is now read from the encoding header
- The backup if one isn't sent is UTF-8. This can be changed with the DEFAULT_ENCODING variable.
- Debugging statements are printed with a function to make the code a little cleaner
v1.1.0: Big error checking changes
Big error checking changes
- Error handling (printing message, printing exception, exiting with exit code) is now handled by a handleError () instead of repeated code.
- Added a concatStringToList () method to format some messages for handleError () where a list is displayed.
- Fixed logic errors in some error handling blocks (mainly by refactoring to a method)
- Script now checks for missing keys in the credentials file instead of waiting for the API to return an error response (this avoids a crash when --debug tries to print the credentials).
- isConnected () now returns early if the interface doesn't exist. This is faster and avoids a crash when trying to find the IP address for an interface that doesn't exist.
- Added unique exit codes for each error. A small explanation is printed when the application exits as well as them being documented in a comment.
- Some formatting changes.
v1.0.5 Minor Changes
Minor Changes
- Default timeout is now 10 seconds for slow connections (the API call sometimes takes a few seconds
even on a decent connection anyway). - isConnected () now checks if the interface exists (this used to be all that was checked) and now if it has at
least one IPV4 address (is up). - ValueError exception is caught if the API response is malformed JSON (for some reason).
- Added documentation for constants to README
v1.0.4 Error Checking Changes
Error Checking Changes
- urllib API call now has a try catch block for HTTPError and URLError exceptions.
- getIPAddress () now checks if the VPN interface has more than 1 IPV4 address and exits if so. The address limit is set by the ADDRESS_LIMIT variable in the method.
Refactoring
- netifaces calls separated into multiple lines to be more legible (multiple data structures involved).
- Some code moved outside of try except blocks.
- Switched methods with more than one argument to named parameters.
v1.0.2 Minor Update
Minor update
- Switched to with statement for opening API connection (instead of relying on destructor).
- Added timeout for API call, the default is 6 seconds but can be updated by modifying the TIMEOUT variable.
v1.0.1 Minor Output Changes
Minor output changes
- License, author, title output uses metadata variables
- Script version and version date are displayed
- Changed displayed messages slightly
- Encoding used to decode API response is now displayed by -debug/--debug
v1.0 First Release
First release after development is mostly done. I shouldn't be making any super breaking changes.
Download and run piascript.pyc or download a source code archive to get the non-compiled script as well as the Readme and License.
Improvements made through development
- Credentials are loaded from a JSON file instead of a hardcoded text file.
- Script is written to be portable (no usage of ifconfig or firewall functionality).
- Uses the netifaces library for querying network interfaces.
- Moved to MIT License.
- Updated Readme with better instructions for creating credentials, etc.
- Added debugging print statements (-debug/--debug).
- Improved exception error messages
- Improved response parsing