mirror of
https://github.com/MercuryWorkshop/epoxy-tls.git
synced 2025-05-12 05:50:01 -04:00
enable atomics and back to optimizing for speed
This commit is contained in:
parent
54011e1f8a
commit
2158b9323e
10 changed files with 45 additions and 65 deletions
|
@ -11,5 +11,6 @@ http-body-util = "0.1.0"
|
|||
hyper = { version = "1.1.0", features = ["http1", "client"] }
|
||||
tokio = { version = "1.36.0", features = ["full"] }
|
||||
tokio-native-tls = "0.3.1"
|
||||
tokio-util = "0.7.10"
|
||||
wisp-mux = { path = "../wisp", features = ["fastwebsockets"]}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ use std::{error::Error, future::Future};
|
|||
use tokio::net::TcpStream;
|
||||
use tokio_native_tls::{native_tls, TlsConnector};
|
||||
use wisp_mux::{ClientMux, StreamType};
|
||||
use tokio_util::either::Either;
|
||||
|
||||
#[derive(Debug)]
|
||||
struct StrError(String);
|
||||
|
@ -59,10 +60,18 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
|
|||
.nth(4)
|
||||
.ok_or(StrError::new("no dest port"))?
|
||||
.parse()?;
|
||||
let should_tls: bool = std::env::args()
|
||||
.nth(5)
|
||||
.ok_or(StrError::new("no should tls"))?
|
||||
.parse()?;
|
||||
|
||||
let socket = TcpStream::connect(format!("{}:{}", &addr, addr_port)).await?;
|
||||
let cx = TlsConnector::from(native_tls::TlsConnector::builder().build()?);
|
||||
let socket = cx.connect(&addr, socket).await?;
|
||||
let socket = if should_tls {
|
||||
let cx = TlsConnector::from(native_tls::TlsConnector::builder().build()?);
|
||||
Either::Left(cx.connect(&addr, socket).await?)
|
||||
} else {
|
||||
Either::Right(socket)
|
||||
};
|
||||
let req = Request::builder()
|
||||
.method("GET")
|
||||
.uri(format!("wss://{}:{}/", &addr, addr_port))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue