From 613d811975a5b6b8f69b56fe2e9c3659209f8f2f Mon Sep 17 00:00:00 2001 From: Evan Pratten Date: Thu, 27 Jul 2023 12:00:48 -0400 Subject: [PATCH] Add macros for handling wg links --- configs/zsh/macros.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/configs/zsh/macros.sh b/configs/zsh/macros.sh index 06080a7..4bc77e9 100644 --- a/configs/zsh/macros.sh +++ b/configs/zsh/macros.sh @@ -117,3 +117,21 @@ ssh-verify(){ ssh-keygen -Y verify -f ~/.ssh/allowed_signers -n file -I $1 -s $2 < $3 fi } + +# Fully restart a wireguard link +wg-restart() { + if [ $# != 1 ]; then + echo "Usage: wg-restart " + else + wg-quick down $1 && wg-quick up $1 + fi +} + +# Reload a wireguard link without stopping it +wg-reload() { + if [ $# != 1 ]; then + echo "Usage: wg-reload " + else + wg syncconf $1 <(wg-quick strip $1) + fi +} \ No newline at end of file