socksx/
lib.rs

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
//! This crate provides SOCKS proxy client and server implementations. It supports both SOCKS5 and SOCKS6 protocols.
//! 
//! While the crate is still in development, it is already usable. 
//! 
//! ## Chaining Features
//!
//! For `SOCKS version 5`, chaining is not supported yet. It will be added in the future.
//! Hence, it works in the following way: Client -> Socks5 -> Destination
//!
//! For `SOCKS version 6`, chaining is supported. It means that you can chain multiple SOCKS6 proxies together.
//! Apart from working like version 5, it can also be used to do this - Eg. Client -> Socks6 -> Socks6 -> Destination




#[macro_use]
extern crate anyhow;
#[macro_use]
extern crate log;
#[macro_use]
extern crate num_derive;

pub use tokio::io::copy_bidirectional;

/// Represents network addresses.
pub use addresses::{Address, ProxyAddress};
/// Manages user credentials.
pub use credentials::Credentials;
/// Handles SOCKS protocol.
pub use interface::SocksHandler;
/// SOCKS5 client and handler.
pub use socks5::{Socks5Client, Socks5Handler};
/// SOCKS6 client and handler.
pub use socks6::{Socks6Client, Socks6Handler};
pub use util::{get_original_dst, resolve_addr, try_read_initial_data};

/// Common network address representations
#[path = "./common/addresses.rs"]
pub mod addresses;

/// SOCKS protocol Constants used across the crate.
#[path = "./common/constants.rs"]
pub mod constants;

/// Credential management for the SOCKS proxy.
#[path = "./common/credentials.rs"]
pub mod credentials;

/// Main interface for handling SOCKS.
#[path = "./common/interface.rs"]
pub mod interface;

/// SOCKS5-specific implementations.
pub mod socks5;

/// SOCKS6-specific implementations.
pub mod socks6;

/// Utility functions and helpers.
#[path = "./common/util.rs"]
pub mod util;