function cmd::inspect::_peer_info() {
  local name="$1"
  local ip type rule status endpoint last_seen tunnel public_key
  local activity rx tx

  ip=$(peers::get_ip "$name")
  type=$(peers::get_type "$name")
  rule=$(peers::get_meta "$name" "rule")
  public_key=$(keys::public "$name" 2>/dev/null)

  # Status + endpoint + last seen — reuse list helpers
  status=$(cmd::list::format_status "$name" "$public_key" "$ip")
  last_seen=$(cmd::list::format_last_seen "$name" "$public_key" "$ip")
  endpoint=$(monitor::get_cached_endpoint "$name")

  # Tunnel mode from AllowedIPs in conf
  local allowed_ips
  allowed_ips=$(grep "^AllowedIPs" "$(ctx::clients)/${name}.conf" 2>/dev/null | cut -d'=' -f2- | xargs)

  activity="$(cmd::inspect::_get_activity "$public_key")"
  
  # Get fresh handshake
  local handshake_ts="0"
  handshake_ts=$(monitor::get_handshake_ts "$public_key")

  local is_blocked="false"
  peers::is_blocked "$name" && is_blocked="true"

  local last_ts
  last_ts=$(monitor::last_attempt "$name")

  local status last_seen
  status=$(cmd::list::_format_status "$name" "$public_key" \
    "$is_blocked" "false" "$handshake_ts" "$last_ts")
  last_seen=$(cmd::list::_format_last_seen "$name" "$public_key" \
    "$is_blocked" "$last_ts" "" "$handshake_ts")

  cmd::inspect::_section "Client"
  ui::row "Name"       "$name"
  ui::row "IP"         "$ip"
  ui::row "Type"       "$(cmd::list::display_type "$name" "$type")"
  ui::row "Rule"       "${rule:-—}"
  ui::row "Status"     "$(echo -e "$status")"
  ui::row "Endpoint"   "${endpoint:-—}"
  ui::row "Last seen"  "$last_seen"
  ui::row "AllowedIPs" "$allowed_ips"
  ui::row "Public key" "${public_key:-—}"
  # ui::row "Total transfer" "${rx_hr} ↓  ${tx_hr} ↑"
  ui::row  "Activity" "${activity:-—}"

}