blob: b22667f7f0a97f0719b8cd1848c40193d628035f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#!/bin/sh
note()
{
command -v notify-send > /dev/null &&
notify-send " vpn" "$1"
printf "\n%s\n" "$1"
}
main()
{
wg_conf="${1:-wg0}"
if ip -details link show "$wg_conf" 2> /dev/null | grep --quiet "wireguard"
then
sudo -A -p " halt, authentication required: " wg-quick down "$wg_conf" &&
note "connection was dropped"
else
sudo -A -p " init, authentication required: " wg-quick up "$wg_conf" &&
note "traffic routed through $wg_conf"
fi
command -v wip > /dev/null &&
wip
}
main "$@"
|