Skip to content

Commit a3efd17

Browse files
committed
Update lib.rs to add dualstack support (windows only atm)
Added this change because the recent change to ipv6 broke my server entirely. This utilizes dual stack to translate ipv4 addresses to ipv6 on windows.
1 parent 4b88f48 commit a3efd17

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

core/src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,11 @@ pub async fn run(
707707
debug!("Port {port} is already in use, trying next port");
708708
port += 1;
709709
}
710-
let addr = SocketAddr::from(([0, 0, 0, 0, 0, 0, 0, 0], port));
710+
let addr = if cfg!(windows) {
711+
SocketAddr::new(std::net::IpAddr::V6(std::net::Ipv6Addr::UNSPECIFIED), port)
712+
} else {
713+
SocketAddr::new(std::net::IpAddr::V4(std::net::Ipv4Addr::UNSPECIFIED), port)
714+
};
711715
let axum_server_handle = axum_server::Handle::new();
712716
tokio::spawn({
713717
let axum_server_handle = axum_server_handle.clone();

0 commit comments

Comments
 (0)