Skip to content

Commit c511b45

Browse files
authored
Merge pull request #220 from magic-wormhole/revert-dilation
Revert dilation Reverts MR #196
2 parents 94cb80a + db22df2 commit c511b45

22 files changed

+190
-1486
lines changed

.github/workflows/push.yml

+1-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Rust
22

33
on:
44
push:
5-
branches: [master, dev, dilation-1]
5+
branches: [master, dev]
66
pull_request:
77
branches: [master, dev]
88

@@ -97,11 +97,6 @@ jobs:
9797
with:
9898
command: build
9999
args: -p magic-wormhole --no-default-features --features=forwarding
100-
- name: build library (features=dilation)
101-
uses: actions-rs/cargo@v1
102-
with:
103-
command: build
104-
args: -p magic-wormhole --no-default-features --features=dilation
105100
- name: build CLI
106101
uses: actions-rs/cargo@v1
107102
with:

Cargo.lock

-85
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+5-7
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ rand = "0.8.0"
2929
log = "0.4.13"
3030
base64 = "0.21.0"
3131
futures_ringbuf = "0.4.0"
32-
async-trait = "0.1.57"
33-
mockall_double = "0.3.0"
3432
time = { version = "0.3.7", features = ["formatting"] }
3533
instant = { version = "0.1.12", features = ["wasm-bindgen"] }
3634

@@ -47,11 +45,12 @@ percent-encoding = { version = "2.1.0" }
4745

4846
# Transit dependencies
4947

48+
5049
stun_codec = { version = "0.3.0", optional = true }
5150
bytecodec = { version = "0.4.15", optional = true }
52-
noise-protocol = { version = "0.2.0-rc1", optional = true }
5351
noise-rust-crypto = { version = "0.6.0-rc.1", optional = true }
54-
52+
async-trait = { version = "0.1.57", optional = true }
53+
noise-protocol = { version = "0.2", optional = true }
5554
# Transfer dependencies
5655

5756
rmp-serde = { version = "1.0.0", optional = true }
@@ -88,21 +87,20 @@ getrandom = { version = "0.2.5", features = ["js"] }
8887
[dev-dependencies]
8988
env_logger = "0.11"
9089
eyre = "0.6.5"
91-
mockall = "0.12"
9290

9391
[features]
9492
transit = [
9593
"socket2",
9694
"stun_codec",
9795
"if-addrs",
9896
"bytecodec",
97+
"async-trait",
9998
"noise-protocol",
10099
"noise-rust-crypto",
101100
]
102101
transfer = ["transit", "tar", "async-tar", "rmp-serde", "zstd"]
103-
dilation = ["transit"]
104102
forwarding = ["transit", "rmp-serde"]
105-
default = ["transfer", "dilation"]
103+
default = ["transit", "transfer"]
106104
all = ["default", "forwarding"]
107105

108106
[profile.release]

cli/src/main.rs

+12-51
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ use futures::{future::Either, Future, FutureExt};
1212
use indicatif::{MultiProgress, ProgressBar};
1313
use std::{io::Write, path::PathBuf};
1414

15-
use magic_wormhole::{
16-
dilated_transfer, forwarding, transfer, transit, MailboxConnection, Wormhole,
17-
};
15+
use magic_wormhole::{forwarding, transfer, transit, MailboxConnection, Wormhole};
1816

1917
fn install_ctrlc_handler(
2018
) -> eyre::Result<impl Fn() -> futures::future::BoxFuture<'static, ()> + Clone> {
@@ -54,14 +52,6 @@ fn install_ctrlc_handler(
5452
})
5553
}
5654

57-
// send, receive,
58-
#[derive(Debug, Args)]
59-
struct CommonTransferArgs {
60-
/// Enable dilation
61-
#[clap(long = "with-dilation", alias = "with-dilation")]
62-
with_dilation: bool,
63-
}
64-
6555
// send, send-many
6656
#[derive(Debug, Args)]
6757
struct CommonSenderArgs {
@@ -187,8 +177,6 @@ enum WormholeCommand {
187177
common_leader: CommonLeaderArgs,
188178
#[clap(flatten)]
189179
common_send: CommonSenderArgs,
190-
#[clap(flatten)]
191-
common_transfer: CommonTransferArgs,
192180
},
193181
/// Send a file to many recipients. READ HELP PAGE FIRST!
194182
#[clap(
@@ -231,8 +219,6 @@ enum WormholeCommand {
231219
common_follower: CommonFollowerArgs,
232220
#[clap(flatten)]
233221
common_receiver: CommonReceiverArgs,
234-
#[clap(flatten)]
235-
common_transfer: CommonTransferArgs,
236222
},
237223
/// Forward ports from one machine to another
238224
#[clap(subcommand)]
@@ -305,7 +291,6 @@ async fn main() -> eyre::Result<()> {
305291
common,
306292
common_leader: CommonLeaderArgs { code, code_length },
307293
common_send: CommonSenderArgs { file_name, files },
308-
common_transfer: CommonTransferArgs { with_dilation: _ },
309294
..
310295
} => {
311296
let offer = make_send_offer(files, file_name).await?;
@@ -386,31 +371,17 @@ async fn main() -> eyre::Result<()> {
386371
common,
387372
common_follower: CommonFollowerArgs { code },
388373
common_receiver: CommonReceiverArgs { file_path },
389-
common_transfer: CommonTransferArgs { with_dilation },
390374
..
391375
} => {
392-
if with_dilation {
393-
log::warn!("The dilation feature is still work in progress. Please remove the `--with-dilation` argument to avoid this.");
394-
}
395-
396376
let transit_abilities = parse_transit_args(&common);
397377
let (wormhole, _code, relay_hints) = {
398-
let app_config = dilated_transfer::APP_CONFIG.with_dilation(with_dilation);
399-
let app_config = if with_dilation {
400-
app_config.app_version(dilated_transfer::AppVersion::new(Some(
401-
dilated_transfer::FileTransferV2Mode::Receive,
402-
)))
403-
} else {
404-
app_config
405-
};
406-
407378
let connect_fut = Box::pin(parse_and_connect(
408379
&mut term,
409380
common,
410381
code,
411382
None,
412383
false,
413-
app_config,
384+
transfer::APP_CONFIG,
414385
None,
415386
clipboard.as_mut(),
416387
));
@@ -420,21 +391,15 @@ async fn main() -> eyre::Result<()> {
420391
}
421392
};
422393

423-
if with_dilation && peer_allows_dilation(wormhole.peer_version()) {
424-
log::debug!("dilate wormhole");
425-
let mut dilated_wormhole = wormhole.dilate()?; // need to pass transit relay URL
426-
dilated_wormhole.run().await;
427-
} else {
428-
Box::pin(receive(
429-
wormhole,
430-
relay_hints,
431-
&file_path,
432-
noconfirm,
433-
transit_abilities,
434-
ctrl_c,
435-
))
436-
.await?;
437-
}
394+
Box::pin(receive(
395+
wormhole,
396+
relay_hints,
397+
&file_path,
398+
noconfirm,
399+
transit_abilities,
400+
ctrl_c,
401+
))
402+
.await?;
438403
},
439404
WormholeCommand::Forward(ForwardCommand::Serve {
440405
targets,
@@ -587,11 +552,6 @@ async fn main() -> eyre::Result<()> {
587552
Ok(())
588553
}
589554

590-
fn peer_allows_dilation(_version: &serde_json::Value) -> bool {
591-
// TODO needs to be implemented
592-
true
593-
}
594-
595555
fn parse_transit_args(args: &CommonArgs) -> transit::Abilities {
596556
match (args.force_direct, args.force_relay) {
597557
(false, false) => transit::Abilities::ALL_ABILITIES,
@@ -905,6 +865,7 @@ async fn send_many(
905865
MailboxConnection::connect(transfer::APP_CONFIG, code.clone(), false).await?,
906866
)
907867
.await?;
868+
908869
send_in_background(
909870
relay_hints.clone(),
910871
make_send_offer(files.clone(), file_name.clone()).await?,

0 commit comments

Comments
 (0)