reachability_core/telemetry/processors/
mod.rs1pub mod interface_aware_logger;
6pub mod link_properties_state;
7
8use fidl_fuchsia_net_interfaces_ext::PortClass;
9
10#[derive(Debug, PartialEq, Eq, Hash, Copy, Clone)]
15pub enum InterfaceType {
16 Ethernet,
17 WlanClient,
18 WlanAp,
19 Blackhole,
20 Bluetooth,
21 Virtual,
22}
23
24impl std::fmt::Display for InterfaceType {
25 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
26 let name = format!("{:?}", self);
27 write!(f, "{}", name.to_lowercase())
28 }
29}
30
31pub enum InterfaceTimeSeriesGrouping {
39 Type(Vec<InterfaceType>),
40}
41
42#[derive(Clone, Debug, Eq, Hash, PartialEq)]
47pub enum InterfaceIdentifier {
48 Type(InterfaceType),
50}
51
52impl std::fmt::Display for InterfaceIdentifier {
53 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
54 let name = match self {
55 Self::Type(ty) => format!("TYPE_{ty}"),
56 };
57 write!(f, "{}", name)
58 }
59}
60
61pub fn identifiers_from_port_class(port_class: PortClass) -> Vec<InterfaceIdentifier> {
62 match port_class {
63 PortClass::Ethernet => vec![InterfaceType::Ethernet],
64 PortClass::WlanClient => vec![InterfaceType::WlanClient],
65 PortClass::WlanAp => vec![InterfaceType::WlanAp],
66 PortClass::Blackhole => vec![InterfaceType::Blackhole],
67 PortClass::Loopback => vec![InterfaceType::Bluetooth, InterfaceType::Virtual],
68 PortClass::Virtual | PortClass::Ppp | PortClass::Bridge | PortClass::Lowpan => {
69 vec![InterfaceType::Virtual]
70 }
71 }
72 .into_iter()
73 .map(|port_class| InterfaceIdentifier::Type(port_class))
74 .collect()
75}