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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
use super::wire_msg::WireMsg;
use std::io;
use thiserror::Error;
pub type Result<T, E = Error> = std::result::Result<T, E>;
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum Error {
#[error("Network bootstrap failed")]
BootstrapFailure,
#[error("No nodes/peers found defined for bootstrapping")]
EmptyBootstrapNodesList,
#[error("Provided path is invalid: {0}")]
InvalidPath(String),
#[error("Couldn't determine user's home directory")]
UserHomeDir,
#[error("I/O Error")]
Io(#[from] io::Error),
#[error("Establishing connection")]
Connect(#[from] quinn::ConnectError),
#[error("Connection lost")]
Connection(#[from] quinn::ConnectionError),
#[error("Creating endpoint")]
Endpoint(#[from] quinn::EndpointError),
#[error("Cannot parse certificate ")]
CertificateParse,
#[error("Cannot parse certificate's private key")]
CertificatePkParse,
#[error("No peers found in the contacts list to send the echo request to")]
NoEchoServerEndpointDefined,
#[error("No response received from echo services")]
NoEchoServiceResponse,
#[error("{0}")]
EchoServiceFailure(String),
#[error("TLS Error ")]
Tls(#[from] rustls::TLSError),
#[error("Serialisation error")]
Serialisation(#[from] bincode::Error),
#[error("Base64 decode")]
Base64Decode(#[from] base64::DecodeError),
#[error("Configuration {0}")]
Configuration(String),
#[error("Invalid message type flag found in message's header: {0}")]
InvalidMsgFlag(u8),
#[error("Stream write error")]
StreamWrite(#[from] quinn::WriteError),
#[error("Failed to read expected number of message bytes: {0}")]
StreamRead(#[from] quinn::ReadExactError),
#[error("Could not use IGD for automatic port forwarding")]
IgdAddPort(#[from] igd::AddAnyPortError),
#[error("Could not renew port mapping using IGD")]
IgdRenewPort(#[from] igd::AddPortError),
#[error("Could not find the gateway device for IGD")]
IgdSearch(#[from] igd::SearchError),
#[error("IGD is not supported on IPv6")]
IgdNotSupported,
#[error("Self-signed certificate generation error: {0}")]
CertificateGen(#[from] rcgen::RcgenError),
#[error("Empty response message received from peer")]
EmptyResponse,
#[error("Type of the message received was not the expected one: {0}")]
UnexpectedMessageType(WireMsg),
#[error("Maximum data length exceeded, length: {0}")]
MaxLengthExceeded(usize),
#[error("Incorrect Public Address provided")]
IncorrectPublicAddress,
#[error("No connection to the dest peer")]
MissingConnection,
#[error("Unexpected internal error: {0}")]
UnexpectedError(String),
#[error("Unspecified Local IP address")]
UnspecifiedLocalIp,
#[error("Unresolved Public IP address")]
UnresolvedPublicIp,
}