15 lines
362 B
Plaintext
15 lines
362 B
Plaintext
|
#!/usr/bin/env bash
|
||
|
if (( $# < 1 )); then
|
||
|
echo "USAGE: $0 LOCATION|off" >&2
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
current_interfaces="$(ip -o a | grep -oE '[0-9]*:\ mullvad-(v6-)?[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
|