From a7c24277ec07855791d94cd7af1e8bbad8601823 Mon Sep 17 00:00:00 2001 From: Oliver Ni Date: Sun, 14 Jul 2024 12:27:31 -0400 Subject: [PATCH] Bind to all interfaces --- src/server.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/server.rs b/src/server.rs index 9ab512b..a75e214 100644 --- a/src/server.rs +++ b/src/server.rs @@ -25,7 +25,13 @@ use tokio::{ use tokio_websockets::{Error, Limits, Message, ServerBuilder}; use tracing::{debug, error, info, trace, warn}; -use std::{convert::Infallible, future::ready, net::SocketAddr, sync::Arc}; +use std::{ + convert::Infallible, + future::ready, + net::{IpAddr, SocketAddr}, + str::FromStr, + sync::Arc, +}; use crate::{ config::CONFIG, @@ -386,7 +392,8 @@ fn handler( } pub async fn run(port: u16, state: State, metrics_handle: PrometheusHandle) -> Result<(), Error> { - let addr: SocketAddr = ([0, 0, 0, 0], port).into(); + let ip = IpAddr::from_str("::").unwrap(); + let addr: SocketAddr = (ip, port).into(); let listener = match TcpListener::bind(addr).await { Ok(listener) => listener,