use std::io;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum SocksError {
#[error("Failure caused by an IO error: {0}")]
Io(#[from] io::Error),
#[error("Failure due to invalid target address: {0}.")]
InvalidTargetAddress(&'static str),
#[error("Proxy server returns an invalid version number.")]
InvalidResponseVersion,
#[error("No acceptable auth methods")]
NoAcceptableAuthMethods,
#[error("Unknown auth method")]
UnknownAuthMethod,
#[error("General SOCKS server failure")]
GeneralSocksServerFailure,
#[error("Connection not allowed by ruleset")]
ConnectionNotAllowedByRuleset,
#[error("Network unreachable")]
NetworkUnreachable,
#[error("Host unreachable")]
HostUnreachable,
#[error("Connection refused")]
ConnectionRefused,
#[error("TTL expired")]
TtlExpired,
#[error("Command not supported")]
CommandNotSupported,
#[error("Address type not supported")]
AddressTypeNotSupported,
#[error("Invalid reserved byte")]
InvalidReservedByte,
#[error("Unknown address type")]
UnknownAddressType,
#[error("Invalid authentication values: {0}.")]
InvalidAuthValues(String),
#[error("Password auth failure (code={0})")]
PasswordAuthFailure(u8),
#[error("Invalid amount of bytes read")]
InvalidAmountOfBytesRead,
}