diff --git a/Cargo.lock b/Cargo.lock index e0f98c3..4f61515 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -236,6 +236,50 @@ version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +[[package]] +name = "epoxy-client" +version = "1.0.0" +dependencies = [ + "async-compression", + "base64", + "bytes", + "console_error_panic_hook", + "either", + "fastwebsockets", + "futures-util", + "getrandom", + "http 1.0.0", + "http-body-util", + "hyper", + "js-sys", + "penguin-mux-wasm", + "pin-project-lite", + "rand", + "ring", + "tokio", + "tokio-rustls", + "tokio-util", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-streams", + "web-sys", + "webpki-roots", + "ws_stream_wasm", +] + +[[package]] +name = "epoxy-server" +version = "1.0.0" +dependencies = [ + "http-body-util", + "hyper", + "hyper-util", + "rusty-penguin", + "tokio", + "tokio-native-tls", + "tokio-tungstenite", +] + [[package]] name = "errno" version = "0.3.8" @@ -1544,50 +1588,6 @@ dependencies = [ "web-sys", ] -[[package]] -name = "wstcp-client" -version = "1.0.0" -dependencies = [ - "async-compression", - "base64", - "bytes", - "console_error_panic_hook", - "either", - "fastwebsockets", - "futures-util", - "getrandom", - "http 1.0.0", - "http-body-util", - "hyper", - "js-sys", - "penguin-mux-wasm", - "pin-project-lite", - "rand", - "ring", - "tokio", - "tokio-rustls", - "tokio-util", - "wasm-bindgen", - "wasm-bindgen-futures", - "wasm-streams", - "web-sys", - "webpki-roots", - "ws_stream_wasm", -] - -[[package]] -name = "wstcp-server" -version = "1.0.0" -dependencies = [ - "http-body-util", - "hyper", - "hyper-util", - "rusty-penguin", - "tokio", - "tokio-native-tls", - "tokio-tungstenite", -] - [[package]] name = "zeroize" version = "1.7.0" diff --git a/README.md b/README.md index 1a735bd..3296ec5 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ -# wsproxy-rust +# epoxy ## Building ### Server 1. Generate certs with `mkcert` and place the public certificate in `./server/src/pem.pem` and private certificate in `./server/src/key.pem` -2. Run `cargo r --bin wstcp-server`, optionally with `-r` flag for release +2. Run `cargo r --bin epoxy-server`, optionally with `-r` flag for release ### Client diff --git a/client/Cargo.toml b/client/Cargo.toml index 55f64ff..376cbc8 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "wstcp-client" +name = "epoxy-client" version = "1.0.0" edition = "2021" diff --git a/client/build.sh b/client/build.sh index 03c053b..3f7a42a 100755 --- a/client/build.sh +++ b/client/build.sh @@ -7,16 +7,19 @@ mkdir out/ cargo build --target wasm32-unknown-unknown --release echo "[ws] built rust" -wasm-bindgen --weak-refs --no-typescript --target no-modules --out-dir out/ ../target/wasm32-unknown-unknown/release/wstcp_client.wasm +wasm-bindgen --weak-refs --no-typescript --target no-modules --out-dir out/ ../target/wasm32-unknown-unknown/release/epoxy_client.wasm echo "[ws] bindgen finished" -mv out/wstcp_client_bg.wasm out/wstcp_client_unoptimized.wasm -time wasm-opt -O4 out/wstcp_client_unoptimized.wasm -o out/wstcp_client_bg.wasm +mv out/epoxy_client_bg.wasm out/epoxy_client_unoptimized.wasm +time wasm-opt -O4 out/epoxy_client_unoptimized.wasm -o out/epoxy_client_bg.wasm echo "[ws] optimized" -AUTOGENERATED_SOURCE=$(<"out/wstcp_client.js") -WASM_BASE64=$(base64 -w0 out/wstcp_client_bg.wasm) -echo "${AUTOGENERATED_SOURCE//__wbg_init(input) \{/__wbg_init(input) \{input=\'data:application/wasm;base64,$WASM_BASE64\'}" > out/wstcp_client_bundled.js +AUTOGENERATED_SOURCE=$(<"out/epoxy_client.js") +WASM_BASE64=$(base64 -w0 out/epoxy_client_bg.wasm) +AUTOGENERATED_SOURCE="${AUTOGENERATED_SOURCE//__wbg_init(input) \{/__wbg_init(input) \{input=\'data:application/wasm;base64,$WASM_BASE64\'}" +AUTOGENERATED_SOURCE="${AUTOGENERATED_SOURCE//let wasm_bindgen/let epoxy}" +AUTOGENERATED_SOURCE="${AUTOGENERATED_SOURCE//wasm_bindgen =/epoxy =}" +echo "${AUTOGENERATED_SOURCE}" > out/epoxy_client_bundled.js cp -r src/web/* out/ echo "[ws] done!" diff --git a/client/src/lib.rs b/client/src/lib.rs index 74248d7..89a4554 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -58,7 +58,7 @@ async fn send_req( wasm_bindgen_futures::spawn_local(async move { if let Err(e) = conn.await { - error!("wstcp: error in muxed hyper connection! {:?}", e); + error!("epoxy: error in muxed hyper connection! {:?}", e); } }); diff --git a/client/src/web/index.html b/client/src/web/index.html index defc525..2237f3d 100644 --- a/client/src/web/index.html +++ b/client/src/web/index.html @@ -1,10 +1,10 @@
-