kgillibrand / PIA-Port-Forwarding-Script

Python script which enables port forwarding for a Private Internet Access VPN

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

New PIA port forwarding API

DanielOaks opened this issue · comments

Hey, nice script! I'm just opening this issue to let you know that we (PIA) have a new port forwarding API available. It'd be worth taking a look on our forums over here: https://www.privateinternetaccess.com/forum/discussion/23431/

Specifically, a few things you'll want to keep in mind with the new API are:

  • You only need to call the API once and the port will stay open forever.
  • There's no need to include the username/password or the local IP, which should help simplify configuration.
  • If port forwarding's already opened, the API will return nothing or reset the API connection (take a look at how the linked script in the topic above does it, to see how we handle this case).

If you run into any issues with it, feel free to reply here and I'll take a look.

Thanks for the tip!

I'll see if I can have a look this weekend

Are there any issues with generating a client ID each time the script is run? I'm just not sure what impact the client ID has behind the scenes in terms of tracking the session or whatnot. The example script does that so It's probably fine, just wanted to double check.

Apart from that I have a basic implementation working. Seems like the error handling on the API end is a little rough though. If I try to port forward again after already calling the API the connection generally gets reset by peer or closed without a response. On gateways that don't support port forwarding the connection gets refused. I suppose that makes sense in that the port forwarding is handled by the gateway itself but I think an error response like the old API used to give is a little more intuitive.

With it working that way it gets hard to distinguish API error responses from connection issues.

Anyway just a bit of feedback in case that behaviour isn't intended, thanks for pointing out the new API had released.

Yeah you can generate a new client ID each time. Yeah I'll have a chat to the team about the error handling, see what we can do there. Glad to hear you've got a basic impl. working, interested to see how it goes.

Sounds good, thanks for the response.

I committed everything last night since everything seems to be working.