summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2025-05-28 15:05:53 -0500
committerCraig Jennings <c@cjennings.net>2025-05-28 15:05:53 -0500
commitd68842c1bd9001d660f889e193785193cb2dabd2 (patch)
treed7683499c9011401d1995b09ebd9c0b695dc7331
parentfc1221f70526353c78971b242079f182dd183ec9 (diff)
add wireguard up/down functions
-rw-r--r--dotfiles/system/.profile.d/fzf.sh14
1 files changed, 13 insertions, 1 deletions
diff --git a/dotfiles/system/.profile.d/fzf.sh b/dotfiles/system/.profile.d/fzf.sh
index 2193614..f195440 100644
--- a/dotfiles/system/.profile.d/fzf.sh
+++ b/dotfiles/system/.profile.d/fzf.sh
@@ -76,9 +76,11 @@ bk() {
fi
}
+
+
# close wireguard connection first if already running, then
# run wireguard, selecting the configuration file.
-wg() {
+wgup() {
# Check if wireguard is running
output=$(sudo wg)
if [[ -n "$output" ]]; then
@@ -95,3 +97,13 @@ wg() {
sudo wg
fi
}
+wgdown() {
+ # Check if wireguard is running
+ output=$(sudo wg)
+ if [[ -n "$output" ]]; then
+ # Shutdown all wg interfaces if WireGuard is currently running.
+ for iface in $(sudo wg show interfaces); do
+ sudo wg-quick down "${iface}"
+ done
+ fi
+}