From 4dc99b4a84f80f9067b05e0a03ec79ea3854e176 Mon Sep 17 00:00:00 2001 From: Oliver Papst Date: Sat, 10 Jan 2026 22:25:31 +0100 Subject: [PATCH] feat: Add IPv6 support for bichon_bind_ip configuration Also try to parse the bind_ip address as std::net::Ipv6Addr to accept both IPv4 and IPv6 addresses. The TcpListener of poem utilizes ToSocketAddrs trait, which also supports IPv6. --- src/modules/settings/cli.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/modules/settings/cli.rs b/src/modules/settings/cli.rs index fbc58f7..e09f188 100644 --- a/src/modules/settings/cli.rs +++ b/src/modules/settings/cli.rs @@ -46,16 +46,16 @@ pub struct Settings { )] pub bichon_http_port: i32, - /// The IP address that the node binds to, in IPv4 format (e.g., 192.168.1.1). + /// The IP address that the node binds to, in IPv4 or IPv6 format (e.g., 192.168.1.1 or ::1). #[clap( long, env, default_value = "0.0.0.0", - help = "The IP address that the node binds to, in IPv4 format (e.g., 192.168.1.1). Required in cluster mode.", + help = "The IP address that the node binds to, in IPv4 or IPv6 format (e.g., 192.168.1.1 or ::1). Required in cluster mode.", value_parser = ValueParser::new(|s: &str| { - // Ensure the input is a valid IPv4 address - if s.parse::().is_err() { - return Err("The bind IP address must be a valid IPv4 address.".to_string()); + // Ensure the input is a valid IPv4 or IPv6 address + if s.parse::().is_err() && s.parse::().is_err() { + return Err("The bind IP address must be a valid IPv4 or IPv6 address.".to_string()); } // If the address is valid, return it