最終更新 1 month ago

修正履歴 cfc2f80379fdb536a2d24a9130b2899b6bd1cf61

gistfile1.txt Raw
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