Skip to content

Commit

Permalink
Bind to all interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-ni committed Jul 14, 2024
1 parent 387accd commit 8f8d90c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 8f8d90c

Please sign in to comment.