1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use crate::model::RuleType;
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Connections {
pub connections: Vec<Connection>,
pub download_total: u64,
pub upload_total: u64,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Connection {
pub id: String,
pub upload: u64,
pub download: u64,
pub metadata: Metadata,
pub rule: RuleType,
pub rule_payload: String,
pub start: DateTime<Utc>,
pub chains: Vec<String>,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Metadata {
#[serde(rename = "type")]
pub connection_type: String,
#[serde(rename = "sourceIP")]
pub source_ip: String,
pub source_port: String,
#[serde(rename = "destinationIP")]
pub destination_ip: String,
pub destination_port: String,
pub host: String,
pub network: String,
}