This commit is contained in:
桥下红药
2025-12-22 21:32:14 +08:00
commit 7cc8896918
10 changed files with 1672 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
use serde::Deserialize;
#[derive(Deserialize, Debug)]
#[allow(dead_code)]
pub struct DhtMessage {
pub t: serde_bytes::ByteBuf,
#[allow(dead_code)] // 用于快速预检查,不在反序列化后使用
pub y: String,
#[allow(dead_code)] // 用于快速预检查,不在反序列化后使用
pub q: Option<String>,
pub a: Option<DhtArgs>,
pub r: Option<DhtResponse>,
}
#[derive(Deserialize, Debug)]
pub struct DhtArgs {
pub id: Option<serde_bytes::ByteBuf>,
pub target: Option<serde_bytes::ByteBuf>,
pub info_hash: Option<serde_bytes::ByteBuf>,
pub token: Option<serde_bytes::ByteBuf>,
pub port: Option<u16>,
pub implied_port: Option<u8>,
}
#[derive(Deserialize, Debug)]
pub struct DhtResponse {
#[serde(default)]
#[allow(dead_code)]
pub id: Option<serde_bytes::ByteBuf>,
#[serde(default)]
pub nodes: Option<serde_bytes::ByteBuf>,
}