08354f7651
* Move client-core to common dir * Factor out socks5-client in its own crate * Possible sdk-socks5 integration * Update changelog * Remove socks5 client lib * Rename crate to include nym- prefix * Trim the socks5 wrapped message so that it's printable * Fix intellij auto refactoring * Post merge fixes
40 lines
803 B
Rust
40 lines
803 B
Rust
#![forbid(unsafe_code)]
|
|
|
|
use std::convert::TryFrom;
|
|
|
|
use self::types::SocksProxyError;
|
|
|
|
pub mod authentication;
|
|
pub(crate) mod client;
|
|
pub(crate) mod mixnet_responses;
|
|
mod request;
|
|
pub mod server;
|
|
pub mod types;
|
|
pub mod utils;
|
|
|
|
/// Version of socks
|
|
const SOCKS4_VERSION: u8 = 0x04;
|
|
const SOCKS5_VERSION: u8 = 0x05;
|
|
|
|
const RESERVED: u8 = 0x00;
|
|
|
|
#[derive(Clone, PartialEq, Eq)]
|
|
pub enum SocksVersion {
|
|
V4 = 0x04,
|
|
V5 = 0x05,
|
|
}
|
|
|
|
pub struct InvalidSocksVersion;
|
|
|
|
impl TryFrom<u8> for SocksVersion {
|
|
type Error = SocksProxyError;
|
|
|
|
fn try_from(version: u8) -> Result<Self, Self::Error> {
|
|
match version {
|
|
SOCKS4_VERSION => Ok(Self::V4),
|
|
SOCKS5_VERSION => Ok(Self::V5),
|
|
_ => Err(SocksProxyError::UnsupportedProxyVersion { version }),
|
|
}
|
|
}
|
|
}
|