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
use openssl::error::ErrorStack;
use std::fmt::Debug;
use std::string::FromUtf8Error;
use std::time::SystemTimeError;
use thiserror::Error;
use crossbeam::channel::{RecvError, RecvTimeoutError, SendError};
use crate::packet::Packet;
#[derive(Error, Debug)]
pub enum AetherError {
#[error("Current time is from future so cannot calculate elapsed time")]
ElapsedTime(#[from] SystemTimeError),
#[error("Failed to lock a mutex")]
MutexLock(&'static str),
#[error("Link module stopped")]
LinkStopped(&'static str),
#[error("Receive timed out")]
RecvTimeout(#[from] RecvTimeoutError),
#[error("Link timed out")]
LinkTimeout,
#[error("Failed to set read timeout on socket")]
SetReadTimeout,
#[error("User not connected")]
NotConnected(String),
#[error("Error parsing yaml string")]
YamlParse(#[from] serde_yaml::Error),
#[error("Error reading file")]
FileRead(std::io::Error),
#[error("Error writing file")]
FileWrite(std::io::Error),
#[error("Other peer cannot be authenticated")]
AuthenticationInvalid(String),
#[error("Other peer cannot be reached when authenticating")]
AuthenticationFailed(String),
#[error("OpenSSL Error")]
OpenSSLError(#[from] ErrorStack),
#[error("Error parsing utf8 string")]
FromUtf8Error(#[from] FromUtf8Error),
#[error("Error decoding base64 string")]
Base64DecodeError(#[from] base64::DecodeError),
#[error("Handshake couldn't complete")]
HandshakeError,
#[error("Error sending on channel")]
ChannelSendError(#[from] SendError<Packet>),
#[error("Error receiving on channel")]
ChannelRecvError(#[from] RecvError),
}