1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
use std::sync::Arc;
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum KitsuneP2pError {
#[error(transparent)]
GhostError(#[from] ghost_actor::GhostError),
#[error(transparent)]
KitsuneError(#[from] kitsune_p2p_types::KitsuneError),
#[error("Routing Space Error: {0:?}")]
RoutingSpaceError(Arc<KitsuneSpace>),
#[error("Routing Agent Error: {0:?}")]
RoutingAgentError(Arc<KitsuneAgent>),
#[error("Decoding Error: {0}")]
DecodingError(Box<str>),
#[error(transparent)]
StdIoError(#[from] std::io::Error),
#[error(transparent)]
Reqwest(#[from] reqwest::Error),
#[error("Bootstrap Error: {0}")]
Bootstrap(Box<str>),
#[error(transparent)]
SystemTime(#[from] std::time::SystemTimeError),
#[error(transparent)]
TryFromInt(#[from] std::num::TryFromIntError),
#[error("Other: {0}")]
Other(Box<dyn std::error::Error + Send + Sync>),
}
pub use crate::actor::KitsuneP2pResult;
impl KitsuneP2pError {
pub fn other(e: impl Into<Box<dyn std::error::Error + Send + Sync>>) -> Self {
Self::Other(e.into())
}
pub fn decoding_error(s: String) -> Self {
Self::DecodingError(s.into_boxed_str())
}
}
impl From<String> for KitsuneP2pError {
fn from(s: String) -> Self {
#[derive(Debug, thiserror::Error)]
struct OtherError(String);
impl std::fmt::Display for OtherError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.0)
}
}
KitsuneP2pError::other(OtherError(s))
}
}
impl From<&str> for KitsuneP2pError {
fn from(s: &str) -> Self {
s.to_string().into()
}
}
pub use kitsune_p2p_types::bin_types::*;
pub mod agent_store {
pub use kitsune_p2p_types::agent_info::*;
}
pub mod actor;
pub mod event;
pub(crate) mod gossip;
#[allow(missing_docs)]
pub mod wire;
pub use gossip::GossipModuleType;
pub use kitsune_p2p_types::dht;
pub use kitsune_p2p_types::dht_arc;
#[allow(missing_docs)]
pub mod metrics;