Skip to content

Commit 299ad61

Browse files
committed
default --bind-tunnels to --bind-addr
1 parent 6a71c9a commit 299ad61

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/main.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ enum Command {
4949
#[clap(short, long, env = "BORE_SECRET", hide_env_values = true)]
5050
secret: Option<String>,
5151

52-
/// IP address where the control server will bind to. Bore clients must reach this.
52+
/// IP address to bind to. Bore clients must reach this.
5353
#[clap(long, default_value = "0.0.0.0")]
5454
bind_addr: String,
5555

56-
/// IP address where tunnels will listen on.
57-
#[clap(long, default_value = "0.0.0.0")]
58-
bind_tunnels: String,
56+
/// IP address where tunnels will listen on. Defaults to --bind-addr.
57+
#[clap(long)]
58+
bind_tunnels: Option<String>,
5959
},
6060
}
6161

@@ -93,7 +93,7 @@ async fn run(command: Command) -> Result<()> {
9393
.exit();
9494
}
9595

96-
let ipaddr_tunnels = bind_tunnels.parse::<IpAddr>();
96+
let ipaddr_tunnels = bind_tunnels.unwrap_or(bind_addr).parse::<IpAddr>();
9797
if ipaddr_tunnels.is_err() {
9898
Args::command()
9999
.error(ErrorKind::InvalidValue, "invalid ip address for tunnel connections")

src/server.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ impl Server {
5454
pub async fn listen(self) -> Result<()> {
5555
let this = Arc::new(self);
5656
let listener = TcpListener::bind((this.bind_addr, CONTROL_PORT)).await?;
57-
info!(addr = ?this.bind_addr, "server listening");
57+
info!(addr = ?this.bind_addr, port = CONTROL_PORT, "server listening");
5858

5959
loop {
6060
let (stream, addr) = listener.accept().await?;
@@ -133,8 +133,9 @@ impl Server {
133133
return Ok(());
134134
}
135135
};
136+
let host = listener.local_addr()?.ip();
136137
let port = listener.local_addr()?.port();
137-
info!(?port, "new client");
138+
info!(?host, ?port, "new client");
138139
stream.send(ServerMessage::Hello(port)).await?;
139140

140141
loop {

0 commit comments

Comments
 (0)