blob: c4d50fa46261a452397ef33135d9a654a2778df8 (
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
|
#!/bin/sh
set -e
[ -n "$DEBUG" ] && set -x
case "$1" in
toggle) exit 1 ;;
esac
extern_ip=$(curl -SsfL http://api.ipify.org/?format=text)
vpn_is_up() {
case "$extern_ip" in
138.201.245.159) return 0 ;; # hetzner node
esac
return 1
}
if vpn_is_up; then
printf '{"text": "", "tooltip": "external ip is %s"}\n' "$extern_ip"
else
# printf '{"text": "", "tooltip": "disconnected"}\n'
printf '{}\n'
fi
|