Merge remote-tracking branch 'origin/master'

Removes unused dependencies and makes the client buffer size a constant.
This commit is contained in:
Mahmoud Al-Qudsi 2022-10-16 16:09:54 -05:00
commit 8a9bc1740d
3 changed files with 2 additions and 50 deletions

48
Cargo.lock generated
View File

@ -118,17 +118,6 @@ dependencies = [
"unicode-width",
]
[[package]]
name = "getrandom"
version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6"
dependencies = [
"cfg-if",
"libc",
"wasi",
]
[[package]]
name = "hermit-abi"
version = "0.1.19"
@ -193,12 +182,6 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "ppv-lite86"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872"
[[package]]
name = "proc-macro2"
version = "1.0.47"
@ -217,36 +200,6 @@ dependencies = [
"proc-macro2",
]
[[package]]
name = "rand"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
dependencies = [
"libc",
"rand_chacha",
"rand_core",
]
[[package]]
name = "rand_chacha"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
dependencies = [
"ppv-lite86",
"rand_core",
]
[[package]]
name = "rand_core"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
dependencies = [
"getrandom",
]
[[package]]
name = "slab"
version = "0.4.7"
@ -283,7 +236,6 @@ version = "0.3.0"
dependencies = [
"futures",
"getopts",
"rand",
"tokio",
]

View File

@ -14,5 +14,4 @@ edition = "2018"
[dependencies]
futures = "0.3.24"
getopts = "0.2.21"
rand = "0.8.5"
tokio = { version = "1.21.2", features = [ "io-util", "net", "rt-multi-thread", "macros", "sync" ] }

View File

@ -8,6 +8,7 @@ use tokio::sync::broadcast;
type BoxedError = Box<dyn std::error::Error + Sync + Send + 'static>;
static DEBUG: AtomicBool = AtomicBool::new(false);
const BUF_SIZE: usize = 1024;
fn print_usage(program: &str, opts: Options) {
let program_path = std::path::PathBuf::from(program);
@ -98,7 +99,7 @@ async fn forward(bind_ip: &str, local_port: i32, remote: &str) -> Result<(), Box
W: tokio::io::AsyncWrite + Unpin,
{
let mut copied = 0;
let mut buf = [0u8; 1024];
let mut buf = [0u8; BUF_SIZE];
loop {
let bytes_read;
tokio::select! {