Skip to content

Commit 0bd4dab

Browse files
committed
wasm
1 parent 4988af7 commit 0bd4dab

20 files changed

Lines changed: 464 additions & 379 deletions

File tree

Cargo.lock

Lines changed: 59 additions & 44 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tunshell-client/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ openssl = { version = "0.10.30", features=["vendored"] }
4646
[target.'cfg(target_arch = "wasm32")'.dependencies]
4747
tokio = { version = "0.2.21", features=["blocking", "time", "io-util", "sync", "macros"] }
4848
wee_alloc = "0.4.5"
49-
wasm-bindgen = "0.2.65"
49+
wasm-bindgen = "0.2.108"
5050
wasm-bindgen-futures = "0.4.15"
5151
console_error_panic_hook = "0.1.6"
5252
console_log = "0.2.0"
53-
js-sys = "0.3.44"
53+
js-sys = "0.3.85"
5454
getrandom = { version = "0.2.6", features=["js"] }
5555

5656
[target.'cfg(target_arch = "wasm32")'.dependencies.web-sys]
57-
version = "0.3.42"
57+
version = "0.3.85"
5858
features = [
5959
"console",
6060
"Crypto",
Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,29 @@
11
#!/bin/bash
22

3-
set -e
3+
set -euo pipefail
44

5-
SCRIPT_DIR=$(dirname "$0")
6-
SCRIPT_DIR=`cd $SCRIPT_DIR;pwd`
5+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
76

8-
cd $SCRIPT_DIR/../
7+
cd "$SCRIPT_DIR/../"
98

109

1110
# Ignore conflicting dependencies which require different
12-
# feature flags based on target. Can be removed once
11+
# feature flags based on target. Can be removed once
1312
# https://github.com/rust-lang/cargo/issues/1197 is resolved
14-
cp Cargo.toml Cargo.toml.orig
15-
trap "mv $PWD/Cargo.toml.orig $PWD/Cargo.toml" EXIT
16-
cat Cargo.toml | sed 's/.*\#no-wasm/\#/g' > Cargo.toml.new
13+
BACKUP_FILE="$(mktemp "$PWD/Cargo.toml.orig.XXXXXX")"
14+
15+
cleanup() {
16+
rm -f Cargo.toml.new
17+
if [ -f "$BACKUP_FILE" ]; then
18+
mv "$BACKUP_FILE" Cargo.toml
19+
fi
20+
}
21+
22+
cp Cargo.toml "$BACKUP_FILE"
23+
trap cleanup EXIT
24+
sed 's/.*\#no-wasm/\#/g' Cargo.toml > Cargo.toml.new
1725
mv Cargo.toml.new Cargo.toml
1826

1927
wasm-pack build
2028
mkdir -p ../website/services/wasm/
21-
cp -aR pkg/* ../website/services/wasm/
29+
cp -aR pkg/* ../website/services/wasm/

tunshell-client/src/config.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,10 @@ fn parse_network_binding(value: &str) -> Result<NetworkPeerBinding, Error> {
258258
)));
259259
};
260260

261-
if local.contains("->") || local.contains("<-") || remote.contains("->") || remote.contains("<-")
261+
if local.contains("->")
262+
|| local.contains("<-")
263+
|| remote.contains("->")
264+
|| remote.contains("<-")
262265
{
263266
return Err(Error::msg(format!(
264267
"network binding contains multiple direction arrows: {}",

tunshell-client/src/server/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ cfg_if::cfg_if! {
3333
#[cfg(test)]
3434
mod tests {
3535
use super::*;
36-
use crate::{ClientMode, Config, network::NetworkPeerConfig};
36+
use crate::{network::NetworkPeerConfig, ClientMode, Config};
3737
use tokio::runtime::Runtime;
3838

3939
#[test]

tunshell-client/src/shell/client/remote_pty.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,11 @@ pub(super) async fn start_remote_pty_master(
260260
) -> Result<u8> {
261261
let _ignore_signals = IgnoreSignals::start();
262262
let (mut demuxer, listener) = ChannelDemuxer::new();
263-
let (network_peer, mut network_peer_rx, mut network_peer_tx) =
264-
NetworkPeer::new(network_peer_config, crate::shell::network::NetworkPeerRole::Client)
265-
.await;
263+
let (network_peer, mut network_peer_rx, mut network_peer_tx) = NetworkPeer::new(
264+
network_peer_config,
265+
crate::shell::network::NetworkPeerRole::Client,
266+
)
267+
.await;
266268

267269
let mut server = tokio::task::spawn_blocking(move || {
268270
let ctx = context::Context::from_pair(STDIN_FD, STDIN_FD);

0 commit comments

Comments
 (0)