From 1b40a42c9c145db6f7bffe9bc3737ed64656ce25 Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Sat, 7 Sep 2019 15:58:30 +0000 Subject: [PATCH] Add shell function for quick management of vpn --- home/.zshrc.local | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/home/.zshrc.local b/home/.zshrc.local index 9162b76..4117376 100644 --- a/home/.zshrc.local +++ b/home/.zshrc.local @@ -129,6 +129,19 @@ function ssim() { ffmpeg -loglevel fatal -i "$1" -i "$2" -lavfi 'ssim=/dev/stdout' -f null - } +function mullvad() ( + if (( $# < 1 )); then + echo "USAGE: $0 LOCATION|off" >&2 + fi + current_interfaces="$(ip -o a|grep -o '[0-9]*:\ mullvad-[a-z][a-z][0-9]*'|uniq|cut -d: -f2|tr -d ' ')" + for current_interface in $current_interfaces; do + sudo wg-quick down "$current_interface" + done + if [ "$1" != "off" ]; then + sudo wg-quick up mullvad-$1 + fi +) + # Audacious does not support symlinks; hack around that function audacious-hack() ( IFS=$'\n'