mirror of
https://github.com/YGGverse/yps.git
synced 2026-03-31 17:05:30 +00:00
initial commit
This commit is contained in:
parent
36556f4f3c
commit
1392fee475
10 changed files with 348 additions and 0 deletions
41
src/yggdrasil/api.rs
Normal file
41
src/yggdrasil/api.rs
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
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)))
|
||||
// }
|
||||
Loading…
Add table
Add a link
Reference in a new issue