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
43
44
use serde::{Deserialize, Serialize};
use crate::packet::Packet;
#[serde_with::skip_serializing_none]
#[derive(Debug, Default, Deserialize, Serialize)]
pub struct FlowInformation {
pub sni: Option<String>,
pub backward_packet_list: Vec<Packet>,
pub forward_packet_list: Vec<Packet>,
}
impl FlowInformation {
pub fn new() -> Self {
Self { ..Default::default() }
}
}
#[cfg(test)]
mod tests {
use crate::flow_information::FlowInformation;
#[test]
fn test_default() {
let default = FlowInformation::default();
assert!(default.sni.is_none());
assert!(default.backward_packet_list.is_empty());
assert!(default.forward_packet_list.is_empty());
}
#[test]
fn test_new() {
let new = FlowInformation::new();
assert!(new.sni.is_none());
assert!(new.backward_packet_list.is_empty());
assert!(new.forward_packet_list.is_empty());
}
}