blob: 0eef247eb067aef96a2ed80cf97a3c62ab48dc27 (
plain) (
tree)
|
|
#!/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 "$@"
|