gistfile1.txt
· 1.0 KiB · Text
Sin formato
# ── Detailed mode ──────────────────────────
if $detailed; then
log::section "WireGuard Clients"
for conf in "${dir}"/*.conf; do
[[ -f "$conf" ]] || continue
local client_name
client_name=$(basename "$conf" .conf)
local ip="${p_ips[$client_name]}"
local type
type=$(cmd::list::_get_type "$ip")
[[ -n "$filter_type" && "$type" != "$filter_type" ]] && continue
cmd::list::show_client "$client_name"
done
return
fi
# ── Table view ─────────────────────────────
log::section "WireGuard Clients"
cmd::list::_render_header $has_groups
for conf in "${dir}"/*.conf; do
[[ -f "$conf" ]] || continue
local client_name
client_name=$(basename "$conf" .conf)
local ip="${p_ips[$client_name]:-}"
if [[ -z "$ip" ]]; then
# Fallback for peers not in precomputed data
ip=$(grep "^Address" "$conf" | awk '{print $3}' | cut -d'/' -f1)
fi
| 1 | # ── Detailed mode ────────────────────────── |
| 2 | |
| 3 | if $detailed; then |
| 4 | log::section "WireGuard Clients" |
| 5 | for conf in "${dir}"/*.conf; do |
| 6 | [[ -f "$conf" ]] || continue |
| 7 | local client_name |
| 8 | client_name=$(basename "$conf" .conf) |
| 9 | local ip="${p_ips[$client_name]}" |
| 10 | local type |
| 11 | type=$(cmd::list::_get_type "$ip") |
| 12 | [[ -n "$filter_type" && "$type" != "$filter_type" ]] && continue |
| 13 | cmd::list::show_client "$client_name" |
| 14 | done |
| 15 | return |
| 16 | fi |
| 17 | |
| 18 | # ── Table view ───────────────────────────── |
| 19 | |
| 20 | log::section "WireGuard Clients" |
| 21 | cmd::list::_render_header $has_groups |
| 22 | |
| 23 | for conf in "${dir}"/*.conf; do |
| 24 | [[ -f "$conf" ]] || continue |
| 25 | |
| 26 | local client_name |
| 27 | client_name=$(basename "$conf" .conf) |
| 28 | |
| 29 | local ip="${p_ips[$client_name]:-}" |
| 30 | if [[ -z "$ip" ]]; then |
| 31 | # Fallback for peers not in precomputed data |
| 32 | ip=$(grep "^Address" "$conf" | awk '{print $3}' | cut -d'/' -f1) |
| 33 | fi |