#!/bin/sh
# Vpn IP

case "$(nmcli -t --fields device,state device)" in
	*wg_aa:connected*) echo aa;;
	*wg_ca:connected*) echo ca;;
	*wg_ia:connected*) echo ia;;
	*wg_mydefault:connected*) echo mydefault;;
	*wg_studio:connected*) echo studio;;
	*) echo none;;
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_ia:connected$'; then
#       echo ia
#elif echo "$nm_device_state" | grep -q '^wg_studio:connected$'; then
#       echo studio
#else
#       echo insp
#fi