dotfiles/scripts/wg-status.sh
2024-10-24 15:16:20 +03:00

12 lines
400 B
Bash
Executable file

#!/usr/bin/env bash
# Get the interface name (assumes the interface is the first line output by `wg show`)
#interface=$(sudo wg show | grep '^interface:' | awk '{print $2}')
interface="nmd"
# Check if there is a recent handshake (this indicates the connection is active)
handshake=$(ip a show "$interface" | grep 'link')
if [[ -n "$handshake" ]]; then
echo "🔒 $interface"
else
echo "🌀"
fi