naggie / dsnet

FAST command to manage a centralised wireguard VPN. Think wg-quick but quicker: key generation + address allocation.
https://calbryant.uk/blog/how-to-set-up-a-wireguard-vpn-in-minutes-with-dsnet/
MIT License
673 stars 33 forks source link

Minimally addresses #71: don't swallow errors. #75

Closed xxxserxxx closed 2 years ago

xxxserxxx commented 2 years ago

Print the errors and return an error exit code if errors are encountered while setting up the network. This doesn't interrupt the execution, and it probably should; however, the patch is minimally invasive. It changes stdout by printing the error, and it changes the exit code; otherwise, the logic is unchanged.

The way I tested this was on a machine where IPv6 has been disabled. It could be similarly tested in a container or VM where ip6 has been disabled. Here's an example run:

phaethusa ~ % sudo ./dsnet up
error bringing up the network: could not add ipv6 addr 2607:f7a0:16:5::c05e to interface permission denied
phaethusa ~ % echo $?
1
botto commented 2 years ago

Amazing, thank you for the PR! I just added some feedback for running cobra commands

naggie commented 2 years ago

Thanks @xxxserxxx, and @botto for reviewing.