Files
RouterOS/RouterOSAssistant/Core/Models/InterfaceTraffic.swift
T
KayandClaude Sonnet 5 4cc30a2016 M24: LAN-Scanner Aktionen-Button, Traffic-Monitor+Sparkline, ARP-Fix
- Rechtsklick-Kontextmenü ersetzt durch sichtbaren "Aktionen"-Button
  je Geräte-Zeile (bisher nicht diskoverbar)
- Live-Traffic pro Port (↓/↑, wiederverwendet InterfaceTrafficMonitor)
  plus kleines Sparkline-Liniendiagramm der letzten 10 Sekunden
  (Swift Charts, neuer TrafficSample-Typ)
- Bug 34: ARP-Tabelle kann mehrere Zeilen für dieselbe MAC halten
  (reachable + stale/failed) — Auflösung bevorzugte bisher blind die
  zuletzt gesehene Zeile statt die erreichbare. Zwei Regressionstests.
- Nebenbefund: dedizierte SSH-Dienste (Backup/NetworkTools/Traffic/
  Update/FactoryReset) haben keinen eigenen Bestätigungspfad für einen
  neuen SSH-Host-Key, scheitern still solange REST verbindet — als
  offener Punkt dokumentiert.

Alles live bestätigt.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-16 11:46:01 +02:00

24 lines
1.1 KiB
Swift

import Foundation
/// A single live throughput sample for one interface, from RouterOS' `/interface monitor-traffic
/// <name> once` — used to distinguish "link up" (`NetworkInterface.running`, already shown) from
/// "actually carrying data right now", which `running` alone can't: a port stays `running` as soon
/// as its link is up/negotiated, even sitting completely idle.
struct InterfaceTraffic: Equatable {
let rxBitsPerSecond: Int
let txBitsPerSecond: Int
var isActive: Bool { rxBitsPerSecond > 0 || txBitsPerSecond > 0 }
}
/// One timestamped throughput reading, kept in a short rolling per-port history so the
/// LAN-Scanner's port headers can show a small sparkline of the last few seconds, not just the
/// current instantaneous value (Nutzerwunsch: "ein kleines Liniendiagramm der letzten 10 Sekunden
/// ... pro port"). Timestamped (not just appended in order) so trimming to "last 10 seconds" stays
/// correct even if a poll tick is ever delayed or skipped, rather than assuming a fixed cadence.
struct TrafficSample: Identifiable {
let id = UUID()
let timestamp: Date
let totalBitsPerSecond: Int
}