r3nor / mullvad-tailscale

Use Mullvad VPN along with Tailscale and/or Zerotier
GNU General Public License v3.0
162 stars 7 forks source link

Duplicate commands + checks? #7

Closed edgar-vincent closed 2 years ago

edgar-vincent commented 2 years ago

Hi,

Thanks a lot for this very useful script.

I noticed that there were duplicate command calls:

https://github.com/r3nor/mullvad-tailscale/blob/1784d3139274e24136f7748a4061c4dfffc6294c/mtc#L136 and https://github.com/r3nor/mullvad-tailscale/blob/1784d3139274e24136f7748a4061c4dfffc6294c/mtc#L139

Also, is this needed https://github.com/r3nor/mullvad-tailscale/blob/1784d3139274e24136f7748a4061c4dfffc6294c/mtc#L153 ?

Thanks.

edgar-vincent commented 2 years ago

Also, the script should probably call exit with an error if either tailscale up or mullvad connect fails (because, for instance, they are not set up properly), otherwise the network might end up in a broken state (no DNS resolution in my case).

edgar-vincent commented 2 years ago

Same thing for nft. Since nftables applies the configuration atomically, it fails completely if any of its evaluations fail (it did in my case for reasons I'll describe in another issue). The script should probably exit and cleanup in that case.

r3nor commented 2 years ago

Have you been able to test the new version?

edgar-vincent commented 2 years ago

I have started debugging it, but haven't finished. It is quite a bit better, but there are a few things that need changing. I'll make a PR when I can.

edgar-vincent commented 2 years ago

Still working on it, there is a lot of reformatting to do. A few general pieces of advice:

This is going to be very useful script!

r3nor commented 2 years ago

Closing as it should be addressed with the latest version. Thank you @edgar-vincent !

edgar-vincent commented 2 years ago

Thanks for merging. The duplicate commands still need to be looked at though, but maybe it requires a specific issue.