mirror of
https://github.com/rzuasti/oott.git
synced 2026-07-08 19:21:54 +02:00
Count passive scanner devices seen in the last hour
Replace the lifetime "devices seen since start" counter in the mDNS, SSDP
and DHCP scanners with a rolling count of distinct devices (deduped by
MAC) seen within the last hour.
Each scanner's status now tracks a MAC -> last-seen-time map; the snapshot
prunes entries older than 60 minutes and reports the remaining count. The
API field name (devices_seen) is unchanged, so only its meaning and the
frontend labels ("N devices in the last hour") are updated.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
d15411a889
commit
72dbbe5e9a
@@ -9,7 +9,7 @@ pub struct DhcpScannerStatusResponse {
|
||||
pub is_listening: bool,
|
||||
/// Seconds the listener has been running (only set when is_listening is true)
|
||||
pub listening_for_seconds: Option<f64>,
|
||||
/// Total device requests processed since the listener started
|
||||
/// Distinct devices seen in the last hour
|
||||
pub devices_seen: u64,
|
||||
/// Seconds since the last device was seen (None if none seen yet)
|
||||
pub last_device_seen_seconds_ago: Option<f64>,
|
||||
@@ -51,7 +51,7 @@ pub async fn status() -> Result<Json<DhcpScannerStatusResponse>, StatusCode> {
|
||||
Ok(Json(DhcpScannerStatusResponse {
|
||||
is_listening: snapshot.is_listening,
|
||||
listening_for_seconds,
|
||||
devices_seen: snapshot.devices_discovered,
|
||||
devices_seen: snapshot.devices_last_hour,
|
||||
last_device_seen_seconds_ago,
|
||||
}))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user