Skip to main content

ripestat_common/resources/
as_path_length.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, strum_macros::Display)]
4#[serde(rename_all = "lowercase")]
5pub enum SortBy {
6    Number,
7    Count,
8    Location,
9    Geo,
10}
11
12#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
13pub struct AsPathLengthRequest {
14    pub resource: String,
15    pub sort_by: Option<SortBy>,
16}
17
18#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
19pub struct AsPathLengthResponse {
20    pub stats: Vec<AsPathLengthStat>,
21    pub resource: String,
22    pub query_time: String,
23    pub sort_by: String,
24}
25
26#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
27pub struct AsPathLengthStat {
28    pub number: i64,
29    pub count: i64,
30    pub location: String,
31    pub stripped: Stripped,
32    pub unstripped: Unstripped,
33}
34
35#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
36pub struct Stripped {
37    pub sum: i64,
38    pub min: i64,
39    pub max: i64,
40    pub avg: f64,
41}
42
43#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
44pub struct Unstripped {
45    pub sum: i64,
46    pub min: i64,
47    pub max: i64,
48    pub avg: f64,
49}