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 crate::CommandReply;
use std::io;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum Error {
#[error("Invalid version: {0}")]
InvalidVersion(u8),
#[error("Too many methods")]
TooManyMethods,
#[error("Invalid handshake")]
InvalidHandshake,
#[error("Invalid command: {0}")]
InvalidCommand(u8),
#[error("Invalid command reply: {0}")]
InvalidCommandReply(u8),
#[error("Command reply with error: {0:?}")]
CommandReply(CommandReply),
#[error("Domain too long {0}")]
DomainTooLong(usize),
#[error("Invalid domain {0:?}")]
InvalidDomain(Vec<u8>),
#[error("Invalid address type {0}")]
InvalidAddressType(u8),
#[error("IO error: {0:?}")]
Io(#[from] io::Error),
}
pub type Result<T, E = Error> = ::std::result::Result<T, E>;