summaryrefslogtreecommitdiff
path: root/sh/vip
diff options
context:
space:
mode:
Diffstat (limited to 'sh/vip')
-rwxr-xr-xsh/vip23
1 files changed, 23 insertions, 0 deletions
diff --git a/sh/vip b/sh/vip
new file mode 100755
index 0000000..b7db458
--- /dev/null
+++ b/sh/vip
@@ -0,0 +1,23 @@
+#!/bin/sh
+# Vpn IP
+
+case "$(nmcli -t --fields device,state device)" in
+ *wg_ia:connected*) echo ia;;
+ *wg_ka:connected*) echo ka;;
+ *wg_mydefault:connected*) echo mydefault;;
+ *wg_studio:connected*) echo studio;;
+ *) echo insp;;
+esac
+printf 'default: '; curl -m1 ifconfig.co
+printf '4: '; curl -4m1 ifconfig.co
+printf '6: '; curl -6m1 ifconfig.co
+
+# the old way, slower and more code
+#nm_device_state="$(nmcli -t --fields device,state device)"
+#if echo "$nm_device_state" | grep -q '^wg_ka:connected$'; then
+# echo ka
+#elif echo "$nm_device_state" | grep -q '^wg_studio:connected$'; then
+# echo studio
+#else
+# echo insp
+#fi