Skip to content

Commit 7974727

Browse files
committed
fix: bind to ipv6 dualstack by default
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent b0b2d21 commit 7974727

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

src/config.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use sqlx::any::AnyConnectOptions;
2020
use std::convert::{TryFrom, TryInto};
2121
use std::env::var;
2222
use std::fmt::{Debug, Display, Formatter};
23-
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
23+
use std::net::{IpAddr, Ipv6Addr, SocketAddr};
2424
use std::path::{Path, PathBuf};
2525
use std::str::FromStr;
2626

@@ -183,9 +183,7 @@ impl TryFrom<PartialConfig> for Config {
183183
let bind = match config.socket {
184184
Some(socket) => Bind::Unix(socket, socket_permissions),
185185
None => {
186-
let ip = config
187-
.bind
188-
.unwrap_or_else(|| IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)));
186+
let ip = config.bind.unwrap_or(IpAddr::V6(Ipv6Addr::UNSPECIFIED));
189187
let port = config.port.unwrap_or(7867);
190188
Bind::Tcp((ip, port).into())
191189
}
@@ -194,9 +192,7 @@ impl TryFrom<PartialConfig> for Config {
194192
let metrics_bind = match (config.metrics_socket, config.metrics_port) {
195193
(Some(socket), _) => Some(Bind::Unix(socket, socket_permissions)),
196194
(None, Some(port)) => {
197-
let ip = config
198-
.bind
199-
.unwrap_or_else(|| IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)));
195+
let ip = config.bind.unwrap_or(IpAddr::V6(Ipv6Addr::UNSPECIFIED));
200196
Some(Bind::Tcp((ip, port).into()))
201197
}
202198
_ => None,

0 commit comments

Comments
 (0)