jamesmcm / vopono

Run applications through VPN tunnels with temporary network namespaces
GNU General Public License v3.0
888 stars 46 forks source link

Add port forwarding with PIA using --port-forwarding #245

Closed BenLand100 closed 10 months ago

BenLand100 commented 10 months ago

Disclaimer: I don't know rust, at all! [Seriously, check this code before doing anything with it!]

This PR removes --protonvpn-port-forwarding and makes a more generic framework triggered by --port-forwarding for API driven port forwarding that also works for PIA. In PIA this is done with an API instead of natpmpc, but I implemented the functionality in basically the same way as natpmpc.

This PR also has several limitations noted by FIXMEs relating to two points:

Hopefully someone can finish this off, or perhaps one day I may get more motivated to learn rust...

BenLand100 commented 10 months ago

This has been a fun exercise playing with rust :) I'll add in a conf option for a callback script this afternoon sometime. Let me know if there are any other pre-merge changes to see to.

jamesmcm commented 10 months ago

Thanks overall it looks great, btw you should be able to run rustfmt with cargo fmt and clippy with cargo clippy locally to run those checks directly (and cargo fmt will reformat it directly).

I think the only thing left is to update the docs (README/USERGUIDE) on the usage too.