mirror of
https://github.com/rzuasti/oott.git
synced 2026-07-08 19:21:54 +02:00
Moved Devices to a models module
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
use chrono::{DateTime, Utc, serde::ts_seconds};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Clone, Serialize, Deserialize)]
|
||||
pub struct Device {
|
||||
pub mac_address: String,
|
||||
pub ipv4_address: String,
|
||||
pub vendor: String,
|
||||
#[serde(with = "ts_seconds")]
|
||||
pub last_seen: DateTime<Utc>,
|
||||
}
|
||||
|
||||
impl fmt::Display for Device {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"mac={}, ip={}, vendor={}, last_seen={}",
|
||||
self.mac_address, self.ipv4_address, self.vendor, self.last_seen
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user