From 9521de5746a74fca53438540d01541e70dfa834a Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Tue, 26 Dec 2017 14:45:38 -0800 Subject: [PATCH] HttpServer::addrs() return all bound socket addresses --- src/server.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/server.rs b/src/server.rs index e5ee5c50e..ab024c8c1 100644 --- a/src/server.rs +++ b/src/server.rs @@ -189,6 +189,11 @@ impl HttpServer self } + /// Get addresses of bound sockets. + pub fn addrs(&self) -> Vec { + self.sockets.keys().map(|addr| addr.clone()).collect() + } + /// The socket address to bind /// /// To mind multiple addresses this method can be call multiple times.