aboutsummaryrefslogtreecommitdiff
path: root/vpn
blob: e1eb2055e8ee214d0e9c9a0e54dab488eda5087c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh

note()
{
	command -v notify-send > /dev/null &&
		notify-send "󰒒  vpn" "$1"

	printf "\n%s\n" "$1"
}

wg_conf="${1:-kay}"

if systemctl status "wg-quick-${wg_conf}.service" > /dev/null 2>&1; then
	sudo -A systemctl stop "wg-quick-${wg_conf}.service" &&
		note "connection was dropped"
else
	sudo -A systemctl start "wg-quick-${wg_conf}.service" &&
		note "traffic routed through $wg_conf"
fi &&
	command -v wip > /dev/null && wip