nuno revidoval tento gist 1 month ago. Přejít na revizi
1 file changed, 30 insertions
gistfile1.txt(vytvořil soubor)
| @@ -0,0 +1,30 @@ | |||
| 1 | + | 204: local collected_rows="" | |
| 2 | + | 205: collected_rows=$(cmd::list::_collect_all_rows | ui::sort_rows) | |
| 3 | + | 207: if [[ -z "$collected_rows" ]]; then | |
| 4 | + | 213: cmd::list::_render_detailed "$collected_rows" | |
| 5 | + | 214: cmd::list::_render_summary_from_rows "$collected_rows" | |
| 6 | + | 223: compact) cmd::list::_render_compact "$collected_rows" ;; | |
| 7 | + | 224: *) cmd::list::_render_compact "$collected_rows" ;; | |
| 8 | + | 229:# Row collection (single pass, all filters) | |
| 9 | + | 232:function cmd::list::_collect_all_rows() { | |
| 10 | + | 291: attempt_ts=$(json::iso_to_ts "$last_ts") | |
| 11 | + | 567: done < <(json::peer_data "$(ctx::clients)" "$(ctx::meta)" "$(ctx::events_log)") | |
| 12 | + | 604: done < <(json::peer_group_map "$groups_dir") | |
| 13 | + | 63: ip=$(peers::get_ip "$name") | |
| 14 | + | 64: type=$(peers::get_type "$name") | |
| 15 | + | 65: rule=$(peers::get_meta "$name" "rule") | |
| 16 | + | 67: allowed_ips=$(grep "^AllowedIPs" "$(ctx::clients)/${name}.conf" \ | |
| 17 | + | 73: peers::is_blocked "$name" && is_blocked="true" || is_blocked="false" | |
| 18 | + | 80: status=$(peers::format_status_verbose "$name" "$public_key" \ | |
| 19 | + | 82: last_seen=$(peers::format_last_seen "$name" "$public_key" \ | |
| 20 | + | 87: activity_total=$(peers::format_activity_total "$public_key") | |
| 21 | + | 90: activity_current=$(peers::format_activity_current "$public_key") | |
| 22 | + | 98: mapfile -t ext < <(json::get "$rule_file" "extends" 2>/dev/null || true) | |
| 23 | + | 117: ui::row "Type" "$(peers::display_type "$type")" "${INSPECT_LABEL_WIDTH}" | |
| 24 | + | 140: rule=$(peers::get_meta "$name" "rule") | |
| 25 | + | 238: mapfile -t groups < <(json::peer_groups "$(ctx::groups)" "$name") | |
| 26 | + | 250: peer_count=$(json::count "$(group::path "$g")" "peers") | |
| 27 | + | 251: [[ "$g" == "$(peers::get_main_group "$name")" ]] && \ | |
| 28 | + | 263: ip=$(peers::get_ip "$name") | |
| 29 | + | 291: cat "$(ctx::clients)/${name}.conf" | |
| 30 | + | 330: name=$(peers::resolve_and_require "$name" "$type") || return 1 | |
Novější
Starší