Skip to content

Commit

Permalink
Merge pull request #1 from RoKu1/reorganize_code_separate_modules
Browse files Browse the repository at this point in the history
Separated modules for socks4 and socks5
  • Loading branch information
RoKu1 authored Jun 17, 2024
2 parents fc21217 + 43c656d commit 376c37c
Show file tree
Hide file tree
Showing 11 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion examples/chainproxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use tokio::{
net::TcpStream,
runtime::Runtime,
};
use tokio_socks::{tcp::Socks5Stream, Error};
use tokio_socks::{tcp::socks5::Socks5Stream, Error};

const PROXY_ADDR: [&str; 2] = ["184.176.166.20:4145", "90.89.205.248:1080"]; // public proxies found here : http://spys.one/en/socks-proxy-list/
const DEST_ADDR: &str = "duckduckgo.com:80";
Expand Down
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ impl<'a> Authentication<'a> {

mod error;
pub mod tcp;
pub mod tcp_socks4;

#[cfg(test)]
mod tests {
Expand Down
2 changes: 2 additions & 0 deletions src/tcp/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pub mod socks4;
pub mod socks5;
File renamed without changes.
File renamed without changes.
7 changes: 1 addition & 6 deletions tests/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@ use once_cell::sync::OnceCell;
use std::{
io::{Read, Write},
net::{SocketAddr, TcpStream as StdTcpStream},
ops::{Deref, DerefMut},
sync::Mutex,
};
use tokio::{
io::{copy, split, AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt},
net::{TcpListener, UnixStream},
runtime::Runtime,
};
use tokio_socks::{
tcp::{Socks5Listener, Socks5Stream},
tcp_socks4::{Socks4Listener, Socks4Stream},
Error, Result,
};
use tokio_socks::{tcp::socks4::Socks4Listener, tcp::socks5::Socks5Listener, Error, Result};

pub const UNIX_PROXY_ADDR: &'static str = "/tmp/proxy.s";
pub const PROXY_ADDR: &'static str = "127.0.0.1:41080";
Expand Down
2 changes: 1 addition & 1 deletion tests/long_username_password_auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ mod common;

use common::{connect_unix, runtime, test_bind, test_connect, ECHO_SERVER_ADDR, PROXY_ADDR, UNIX_PROXY_ADDR};
use tokio_socks::{
tcp::{Socks5Listener, Socks5Stream},
tcp::socks5::{Socks5Listener, Socks5Stream},
Result,
};

Expand Down
2 changes: 1 addition & 1 deletion tests/no_auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ mod common;
use crate::common::{runtime, test_bind};
use common::{connect_unix, test_connect, ECHO_SERVER_ADDR, PROXY_ADDR, UNIX_PROXY_ADDR};
use tokio_socks::{
tcp::{Socks5Listener, Socks5Stream},
tcp::socks5::{Socks5Listener, Socks5Stream},
Result,
};

Expand Down
2 changes: 1 addition & 1 deletion tests/socks4_no_auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use common::{
connect_unix, test_bind_socks4, test_connect, ECHO_SERVER_ADDR, SOCKS4_PROXY_ADDR, UNIX_SOCKS4_PROXY_ADDR,
};
use tokio_socks::{
tcp_socks4::{Socks4Listener, Socks4Stream},
tcp::socks4::{Socks4Listener, Socks4Stream},
Result,
};

Expand Down
2 changes: 1 addition & 1 deletion tests/socks4_userid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ mod common;
use common::{
connect_unix, runtime, test_bind_socks4, test_connect, ECHO_SERVER_ADDR, SOCKS4_PROXY_ADDR, UNIX_SOCKS4_PROXY_ADDR,
};
use tokio_socks::{tcp_socks4::*, Result};
use tokio_socks::{tcp::socks4::*, Result};

#[test]
fn connect_userid() -> Result<()> {
Expand Down
2 changes: 1 addition & 1 deletion tests/username_auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ mod common;

use common::{connect_unix, runtime, test_bind, test_connect, ECHO_SERVER_ADDR, PROXY_ADDR, UNIX_PROXY_ADDR};
use tokio_socks::{
tcp::{Socks5Listener, Socks5Stream},
tcp::socks5::{Socks5Listener, Socks5Stream},
Result,
};

Expand Down

0 comments on commit 376c37c

Please sign in to comment.