Skip to content

Commit

Permalink
Merge pull request iiab#3813 from holta/iiab-vpn_status4
Browse files Browse the repository at this point in the history
Cleaner columns in iiab-vpn output, when tag &/or relay missing
  • Loading branch information
holta authored Sep 30, 2024
2 parents 90d6af3 + 08f2f21 commit 772c5ec
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion roles/tailscale/templates/iiab-vpn
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ echo -e " tailscale logout\n"
#tailscale status --json | jq -r '.Self,.Peer[] | .Tags[] + " " + .TailscaleIPs[] + " " + .HostName + " " + .DNSName + " " + .OS + " " + .Relay + " " + (.Online|tostring)' | sort -V | column -t
#echo -e '\e[44;1mVPN peers: ("true" in 6th column means online)\e[0m\n'
echo -e '\e[44;1mVPN peers: (6th column = online/offline)\e[0m\n'
tailscale status --json | jq -r '.Self,.Peer[] | .Tags[] + " " + .TailscaleIPs[] + " " + .HostName + " " + .DNSName + " " + .Relay + " XXX" + (.Online|tostring) + "XXX " + .OS' | sort -V | column -t | \
tailscale status --json | jq -r '.Self,.Peer[] | (if .Tags[] == "" then "-" else .Tags[] end) + " " + .TailscaleIPs[] + " " + .HostName + " " + .DNSName + " " + (if .Relay == "" then "-" else .Relay end) + " XXX" + (.Online|tostring) + "XXX " + .OS' | sort -V | column -t | \
while read l; do
line=$(echo "$l" | sed 's/ XXXtrueXXX /\\e[0;32m ✅\\e[0m/ ; s/ XXXfalseXXX /\\e[0;31m ❌ \\e[0m/')
echo -e "$line" $(tailscale whois --json $(echo $line | cut -d' ' -f2) | jq -r '.Node.Hostinfo | .Distro + " " + .DistroVersion + " " + .DeviceModel');
Expand Down

0 comments on commit 772c5ec

Please sign in to comment.