1use multiaddr::PeerId;
2
3#[derive(thiserror::Error, Debug)]
4pub enum TrafficGenerationError<P>
5where
6 P: MeasurablePath,
7{
8 #[error("timed out for near neighbor probe '{0:?}'")]
9 ProbeNeighborTimeout(PeerId),
10
11 #[error("timed out for loopback probe")]
12 ProbeLoopbackTimeout(P),
13}
14
15pub trait MeasurableNeighbor {
17 fn peer(&self) -> &PeerId;
18 fn rtt(&self) -> std::time::Duration;
19}
20
21pub trait MeasurablePath {
23 fn id(&self) -> &[u8];
24 fn path(&self) -> &[u8];
25 fn timestamp(&self) -> u128;
26}
27
28#[derive(Debug, Clone)]
30pub enum Telemetry<N, P>
31where
32 N: MeasurableNeighbor + Clone,
33 P: MeasurablePath + Clone,
34{
35 Loopback(P),
39 Neighbor(N),
43}