From 5ca79bb6b99564bc91e919e72cacddecc684ced2 Mon Sep 17 00:00:00 2001 From: Benjamin Saunders Date: Thu, 17 May 2018 00:36:53 -0700 Subject: [PATCH] examples: allow arbitrary listen address --- quicr/examples/server.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/quicr/examples/server.rs b/quicr/examples/server.rs index e57d5a428..7a57aab8e 100644 --- a/quicr/examples/server.rs +++ b/quicr/examples/server.rs @@ -15,6 +15,7 @@ use std::path::{self, Path, PathBuf}; use std::str; use std::rc::Rc; use std::ascii; +use std::net::SocketAddr; use futures::{Future, Stream}; use tokio::executor::current_thread; @@ -67,6 +68,9 @@ struct Opt { /// Enable stateless retries #[structopt(long = "stateless-retry")] stateless_retry: bool, + /// Address to listen on + #[structopt(long = "listen", default_value = "[::]:4433")] + listen: SocketAddr, } fn main() { @@ -110,7 +114,7 @@ fn run(log: Logger, options: Opt) -> Result<()> { builder.generate_insecure_certificate().context("failed to generate certificate")?; } - let (_, driver, incoming) = builder.bind("[::]:4433")?; + let (_, driver, incoming) = builder.bind(options.listen)?; runtime.spawn(incoming.for_each(move |conn| { handle_connection(&root, &log, conn); Ok(()) })); runtime.block_on(driver)?;