This commit is contained in:
lobanov_v committed 2026-09-27 13:36:36 +00:00
1 parent 9c58aab51c
commit 76fc9a89cf
4 files changed
+245

No files matched your search

+38
View File
@@ -0,0 +1,38 @@
#!/bin/bash
set -euo pipefail
HBBR="hbbr"
PID="$(docker inspect -f '{{.State.Pid}}' "$HBBR")"
if [ -z "$PID" ] || [ "$PID" = "0" ]; then
echo "hbbr container is not running" >&2
exit 1
fi
get_connections() {
nsenter -t "$PID" -n ss -H -tn state established '( sport = :21117 )'
}
case "${1:-}" in
connections)
get_connections | wc -l
;;
sessions)
count="$(get_connections | wc -l)"
echo $((count / 2))
;;
relay_ips)
get_connections |
awk '{print $4}' |
sed -E 's/^\[::ffff:([^]]+)\]:[0-9]+$/\1/' |
sort -u
;;
*)
echo "Usage: $0 {connections|sessions|relay_ips}" >&2
exit 2
;;
esac