Skip to content

Commit 75f1686

Browse files
committed
feat: formated
1 parent fdef3dd commit 75f1686

File tree

2 files changed

+29
-20
lines changed

2 files changed

+29
-20
lines changed

src/main.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ use dumbpipe::NodeTicket;
44
use iroh::{endpoint::Connecting, Endpoint, NodeAddr, RelayMode, RelayUrl, SecretKey, Watcher};
55
use n0_snafu::{Result, ResultExt};
66
use std::{
7-
fmt::{Display, Formatter}, io, net::{SocketAddr, SocketAddrV4, SocketAddrV6, ToSocketAddrs}, str::FromStr
7+
fmt::{Display, Formatter},
8+
io,
9+
net::{SocketAddr, SocketAddrV4, SocketAddrV6, ToSocketAddrs},
10+
str::FromStr,
811
};
912
use tokio::{
1013
io::{AsyncRead, AsyncWrite, AsyncWriteExt},
@@ -119,15 +122,15 @@ pub struct CommonArgs {
119122
/// Otherwise, it will be parsed as a hex string.
120123
#[clap(long)]
121124
pub custom_alpn: Option<String>,
122-
125+
123126
/// The relay URL to use as a home relay,
124127
///
125128
/// Can be set to "disabled" to disable relay servers and "custom"
126-
/// to configure custom servers. The default is the n0 quickest responding
127-
/// relay if the flag is not set.
129+
/// to configure custom servers. The default is the n0 quickest responding
130+
/// relay if the flag is not set.
128131
#[clap(long, default_value_t = RelayModeOption::Default)]
129132
pub relay: RelayModeOption,
130-
133+
131134
/// The verbosity level. Repeat to increase verbosity.
132135
#[clap(short = 'v', long, action = clap::ArgAction::Count)]
133136
pub verbose: u8,

tests/cli.rs

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -505,13 +505,16 @@ fn connect_listen_relay_disabled() {
505505
let ticket = header.split_ascii_whitespace().last().unwrap();
506506
let ticket = NodeTicket::from_str(ticket).unwrap();
507507

508-
let connect = duct::cmd(dumbpipe_bin(), ["connect", &ticket.to_string(), "--relay", "disabled"])
509-
.env_remove("RUST_LOG")
510-
.stdin_bytes(connect_to_listen)
511-
.stderr_null()
512-
.stdout_capture()
513-
.run()
514-
.unwrap();
508+
let connect = duct::cmd(
509+
dumbpipe_bin(),
510+
["connect", &ticket.to_string(), "--relay", "disabled"],
511+
)
512+
.env_remove("RUST_LOG")
513+
.stdin_bytes(connect_to_listen)
514+
.stderr_null()
515+
.stdout_capture()
516+
.run()
517+
.unwrap();
515518

516519
assert!(connect.status.success());
517520
assert_eq!(&connect.stdout, listen_to_connect);
@@ -537,13 +540,16 @@ fn connect_listen_relay_default() {
537540
let ticket = header.split_ascii_whitespace().last().unwrap();
538541
let ticket = NodeTicket::from_str(ticket).unwrap();
539542

540-
let connect = duct::cmd(dumbpipe_bin(), ["connect", &ticket.to_string(), "--relay", "default"])
541-
.env_remove("RUST_LOG")
542-
.stdin_bytes(connect_to_listen)
543-
.stderr_null()
544-
.stdout_capture()
545-
.run()
546-
.unwrap();
543+
let connect = duct::cmd(
544+
dumbpipe_bin(),
545+
["connect", &ticket.to_string(), "--relay", "default"],
546+
)
547+
.env_remove("RUST_LOG")
548+
.stdin_bytes(connect_to_listen)
549+
.stderr_null()
550+
.stdout_capture()
551+
.run()
552+
.unwrap();
547553

548554
assert!(connect.status.success());
549555
assert_eq!(&connect.stdout, listen_to_connect);
@@ -560,6 +566,6 @@ fn relay_option_invalid() {
560566
.stderr_capture()
561567
.stdout_capture()
562568
.run();
563-
569+
564570
assert!(output.is_err() || !output.unwrap().status.success());
565571
}

0 commit comments

Comments
 (0)