-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vpn
25 lines (24 loc) · 929 Bytes
/
.vpn
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
vpn() {
# Define the VPN interface name
local vpn_interface="zcs-sviluppo"
# Check if the VPN interface is up (replace 'zcs-sviluppo' with your specific WireGuard interface name if different)
if ip a show "$vpn_interface" &> /dev/null; then
echo "The current state of the VPN is ON."
echo -n "Do you want to switch it OFF? (y/n): "
read response
if [[ "$response" =~ ^[Yy]$ ]]; then
sudo wg-quick down /etc/wireguard/"$vpn_interface".conf && echo "VPN is now OFF."
else
echo "No changes made."
fi
else
echo "The current state of the VPN is OFF."
echo -n "Do you want to switch it ON? (y/n): "
read response
if [[ "$response" =~ ^[Yy]$ ]]; then
sudo wg-quick up /etc/wireguard/"$vpn_interface".conf && echo "VPN is now ON."
else
echo "No changes made."
fi
fi
}