require valid SocketAddr

This commit is contained in:
yggverse 2025-09-08 14:47:26 +03:00
parent 91186b8641
commit bdc5496d45

View file

@ -1,12 +1,15 @@
use clap::Parser; use clap::Parser;
use std::path::PathBuf; use std::{
net::{Ipv4Addr, SocketAddr, SocketAddrV4},
path::PathBuf,
};
#[derive(Parser, Debug)] #[derive(Parser, Debug)]
#[command(version, about, long_about = None)] #[command(version, about, long_about = None)]
pub struct Argument { pub struct Argument {
/// Bind server `host:port` to listen incoming connections on it /// Bind server `host:port` to listen incoming connections on it
#[arg(short, long, default_value_t = std::net::SocketAddrV4::new(std::net::Ipv4Addr::LOCALHOST, 1965).to_string())] #[arg(short, long, default_value_t = SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::LOCALHOST, 1965)))]
pub bind: String, pub bind: SocketAddr,
/// Filepath to server identity in PKCS (PFX) format /// Filepath to server identity in PKCS (PFX) format
#[arg(short, long)] #[arg(short, long)]