diff --git a/src/main.rs b/src/main.rs index 6207d6d..b8b4391 100644 --- a/src/main.rs +++ b/src/main.rs @@ -49,13 +49,13 @@ enum Command { #[clap(short, long, env = "BORE_SECRET", hide_env_values = true)] secret: Option, - /// IP address where the control server will bind to. Bore clients must reach this. + /// IP address to bind to. Bore clients must reach this. #[clap(long, default_value = "0.0.0.0")] bind_addr: String, - /// IP address where tunnels will listen on. - #[clap(long, default_value = "0.0.0.0")] - bind_tunnels: String, + /// IP address where tunnels will listen on. Defaults to --bind-addr. + #[clap(long)] + bind_tunnels: Option, }, } @@ -93,7 +93,7 @@ async fn run(command: Command) -> Result<()> { .exit(); } - let ipaddr_tunnels = bind_tunnels.parse::(); + let ipaddr_tunnels = bind_tunnels.unwrap_or(bind_addr).parse::(); if ipaddr_tunnels.is_err() { Args::command() .error(ErrorKind::InvalidValue, "invalid ip address for tunnel connections") diff --git a/src/server.rs b/src/server.rs index 45bb75e..0de063c 100644 --- a/src/server.rs +++ b/src/server.rs @@ -54,7 +54,7 @@ impl Server { pub async fn listen(self) -> Result<()> { let this = Arc::new(self); let listener = TcpListener::bind((this.bind_addr, CONTROL_PORT)).await?; - info!(addr = ?this.bind_addr, "server listening"); + info!(addr = ?this.bind_addr, port = CONTROL_PORT, "server listening"); loop { let (stream, addr) = listener.accept().await?; @@ -133,8 +133,9 @@ impl Server { return Ok(()); } }; + let host = listener.local_addr()?.ip(); let port = listener.local_addr()?.port(); - info!(?port, "new client"); + info!(?host, ?port, "new client"); stream.send(ServerMessage::Hello(port)).await?; loop {