use serde::Deserialize; #[derive(Deserialize, Debug, Clone)] #[allow(dead_code)] /// Decoded KRPC envelope. pub struct DhtMessage { /// Transaction ID bytes. pub t: serde_bytes::ByteBuf, #[allow(dead_code)] /// Message kind (`q`, `r`, or `e`). pub y: String, #[allow(dead_code)] /// Query method when `y == q`. pub q: Option, /// Query arguments. pub a: Option, /// Response dictionary. pub r: Option, } #[derive(Deserialize, Debug, Clone)] /// Supported BEP-5 query arguments. pub struct DhtArgs { /// Sender node ID. pub id: Option, /// find_node target ID. pub target: Option, /// get_peers/announce InfoHash. pub info_hash: Option, /// announce validation token. pub token: Option, /// Explicit announced Peer port. pub port: Option, /// Non-zero means use the UDP source port. pub implied_port: Option, } #[derive(Deserialize, Debug, Clone)] /// Supported BEP-5 response fields. pub struct DhtResponse { #[serde(default)] #[allow(dead_code)] /// Responder node ID. pub id: Option, #[serde(default)] /// Compact IPv4 node tuples. pub nodes: Option, #[serde(default)] /// Compact IPv6 node tuples. pub nodes6: Option, #[serde(default)] /// Compact Peer endpoints returned by `get_peers`. pub values: Option>, #[serde(default)] /// BEP-51 concatenated 20-byte sampled InfoHashes. pub samples: Option, #[serde(default)] /// BEP-51 estimated number of InfoHashes held by the responder. pub num: Option, #[serde(default)] /// BEP-51 requested delay before sampling this node again, in seconds. pub interval: Option, }