mirror of
https://github.com/YGGverse/yps.git
synced 2026-03-31 08:55:28 +00:00
41 lines
1.1 KiB
Rust
41 lines
1.1 KiB
Rust
use serde::Deserialize;
|
|
|
|
#[derive(Deserialize, Debug)]
|
|
pub struct Response<T> {
|
|
pub response: Option<T>,
|
|
pub status: String,
|
|
}
|
|
|
|
#[derive(Deserialize, Debug)]
|
|
pub struct LocalPeers {
|
|
pub peers: Vec<LocalPeer>,
|
|
}
|
|
|
|
#[derive(Deserialize, Debug)]
|
|
pub struct LocalPeer {
|
|
pub key: String,
|
|
// pub address: std::net::Ipv6Addr,
|
|
// pub bytes_recvd: Option<u64>,
|
|
// pub bytes_sent: Option<u64>,
|
|
// pub inbound: bool,
|
|
// #[serde(default, deserialize_with = "time")]
|
|
// pub last_error_time: Option<Duration>,
|
|
// pub last_error: Option<String>,
|
|
// #[serde(default, deserialize_with = "time")]
|
|
// pub latency: Option<Duration>,
|
|
// pub port: u64,
|
|
// pub priority: Option<u64>,
|
|
// pub remote: Option<String>,
|
|
// pub up: bool,
|
|
// pub uptime: Option<f64>,
|
|
}
|
|
|
|
#[derive(Deserialize, Debug)]
|
|
pub struct RemotePeers {
|
|
pub keys: Vec<String>,
|
|
}
|
|
|
|
// use std::time::Duration;
|
|
// fn time<'de, D: serde::Deserializer<'de>>(d: D) -> Result<Option<Duration>, D::Error> {
|
|
// u64::deserialize(d).map(|t| Some(Duration::from_nanos(t)))
|
|
// }
|