最后活跃于 1 month ago

nuno 修订了这个 Gist 1 month ago. 转到此修订

1 file changed, 33 insertions

gistfile1.txt(文件已创建)

@@ -0,0 +1,33 @@
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
上一页 下一页