This commit is contained in:
桥下红药
2025-12-22 21:32:14 +08:00
commit 7cc8896918
10 changed files with 1672 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
use thiserror::Error;
#[derive(Error, Debug)]
pub enum DHTError {
#[error("网络错误: {0}")]
Network(#[from] std::io::Error),
#[error("Bencode 解析错误: {0}")]
Bencode(String),
#[error("协议错误: {0}")]
Protocol(String),
#[error("超时")]
Timeout,
#[error("未找到 Peer")]
NoPeersAvailable,
#[error("元数据验证失败")]
InvalidMetadata,
}
pub type Result<T> = std::result::Result<T, DHTError>;