From 791ecfb0fe219172d0749667a82e4986f7f959e0 Mon Sep 17 00:00:00 2001 From: Dennis Schwerdel Date: Thu, 4 Feb 2021 22:12:20 +0100 Subject: [PATCH] Remove tls support on client --- Cargo.lock | 128 ------------------------------------------------- Cargo.toml | 4 +- src/wsproxy.rs | 7 +-- 3 files changed, 4 insertions(+), 135 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 473e8c3..ab39a83 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -149,22 +149,6 @@ version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28b9d6de7f49e22cf97ad17fc4036ece69300032f45f78f30b4a4482cdc3f4a6" -[[package]] -name = "core-foundation" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a89e2ae426ea83155dccf10c0fa6b1463ef6d5fcb44cee0b224a408fa640a62" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b" - [[package]] name = "cpuid-bool" version = "0.1.2" @@ -318,21 +302,6 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - [[package]] name = "form_urlencoded" version = "1.0.0" @@ -519,24 +488,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "native-tls" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8d96b2e1c8da3957d58100b09f102c6d9cfdfced01b7ec5a8974044bb09dbd4" -dependencies = [ - "lazy_static", - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - [[package]] name = "nix" version = "0.14.1" @@ -599,51 +550,12 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" -[[package]] -name = "openssl" -version = "0.10.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "038d43985d1ddca7a9900630d8cd031b56e4794eecc2e9ea39dd17aa04399a70" -dependencies = [ - "bitflags", - "cfg-if 1.0.0", - "foreign-types", - "lazy_static", - "libc", - "openssl-sys", -] - -[[package]] -name = "openssl-probe" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" - -[[package]] -name = "openssl-sys" -version = "0.9.60" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "921fc71883267538946025deffb622905ecad223c28efbfdef9bb59a0175f3e6" -dependencies = [ - "autocfg", - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "percent-encoding" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" -[[package]] -name = "pkg-config" -version = "0.3.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" - [[package]] name = "plotters" version = "0.3.0" @@ -882,45 +794,12 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "schannel" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" -dependencies = [ - "lazy_static", - "winapi", -] - [[package]] name = "scopeguard" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" -[[package]] -name = "security-framework" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1759c2e3c8580017a484a7ac56d3abc5a6c1feadf88db2f3633f12ae4268c69" -dependencies = [ - "bitflags", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework-sys" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f99b9d5e26d2a71633cc4f2ebae7cc9f874044e0c351a27e17892d76dce5678b" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "semver" version = "0.9.0" @@ -1248,7 +1127,6 @@ dependencies = [ "httparse", "input_buffer", "log", - "native-tls", "rand", "sha-1", "url", @@ -1321,12 +1199,6 @@ version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05e42f7c18b8f902290b009cde6d651262f956c98bc51bca4cd1d511c9cd85c7" -[[package]] -name = "vcpkg" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b00bca6106a5e23f3eee943593759b7fcddb00554332e856d990c893966879fb" - [[package]] name = "vec_map" version = "0.8.2" diff --git a/Cargo.toml b/Cargo.toml index 01a017f..69292f4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,7 +29,7 @@ privdrop = "0.5" byteorder = "1.4" thiserror = "1.0" smallvec = "1.6" -tungstenite = { version = "0.12", optional = true } +tungstenite = { version = "0.12", optional = true, default-features = false } url = { version = "2.2", optional = true } [dev-dependencies] @@ -37,7 +37,7 @@ tempfile = "3" criterion = "0.3" [features] -default = ["nat"] +default = ["nat", "websocket"] nat = ["igd"] websocket = ["tungstenite", "url"] diff --git a/src/wsproxy.rs b/src/wsproxy.rs index 775059c..1013d55 100644 --- a/src/wsproxy.rs +++ b/src/wsproxy.rs @@ -11,7 +11,7 @@ use std::{ os::unix::io::{AsRawFd, RawFd}, thread::spawn }; -use tungstenite::{client::AutoStream, connect, protocol::WebSocket, server::accept, stream::Stream, Message}; +use tungstenite::{client::AutoStream, connect, protocol::WebSocket, server::accept, Message}; use url::Url; @@ -119,10 +119,7 @@ impl ProxyConnection { impl AsRawFd for ProxyConnection { fn as_raw_fd(&self) -> RawFd { - match self.socket.get_ref() { - Stream::Plain(sock) => sock.as_raw_fd(), - Stream::Tls(sock) => sock.get_ref().as_raw_fd() - } + self.socket.get_ref().as_raw_fd() } }