refactor(eww -> scripts -> vpn_status): Now using wireguard vpn
This commit is contained in:
parent
72ec110591
commit
7ace951889
1 changed files with 7 additions and 7 deletions
|
@ -1,13 +1,13 @@
|
||||||
#!/bin/dash
|
#!/bin/dash
|
||||||
|
|
||||||
config=OVH
|
config=/etc/wireguard/ovh.conf
|
||||||
|
interface_name="ovh"
|
||||||
|
|
||||||
is_connected (){
|
is_connected (){
|
||||||
openvpn3 session-stats --config OVH > /dev/null 2>&1
|
if ip link show up | grep -q "$interface_name"; then
|
||||||
if [ $? -ne 0 ] ; then
|
|
||||||
echo "false"
|
|
||||||
else
|
|
||||||
echo "true"
|
echo "true"
|
||||||
|
else
|
||||||
|
echo "false"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,9 +15,9 @@ connected="$(is_connected)"
|
||||||
|
|
||||||
if [ "$1" = "toggle" ]; then
|
if [ "$1" = "toggle" ]; then
|
||||||
if [ "$connected" = "false" ]; then
|
if [ "$connected" = "false" ]; then
|
||||||
openvpn3 session-start --config "$config" > /dev/null
|
sudo wg-quick up "$config" > /dev/null
|
||||||
else
|
else
|
||||||
openvpn3 session-manage --disconnect --config "$config" > /dev/null
|
sudo wg-quick down "$config" > /dev/null
|
||||||
fi
|
fi
|
||||||
eww update vpn_status="{\"connected\": $(is_connected)}"
|
eww update vpn_status="{\"connected\": $(is_connected)}"
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in a new issue