use human_units for Duration params
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
use clap::{CommandFactory, Parser, Subcommand};
|
||||
use eyre::{format_err, Result};
|
||||
use human_units::Duration;
|
||||
use log::{debug, error};
|
||||
use std::net::SocketAddr;
|
||||
use std::time::Duration;
|
||||
use tokio::fs;
|
||||
|
||||
#[derive(Parser)]
|
||||
@@ -71,12 +71,12 @@ enum Command {
|
||||
#[arg(long, short = 'l')]
|
||||
listen: Vec<SocketAddr>,
|
||||
targets: Vec<SocketAddr>,
|
||||
/// target polling interval, in seconds
|
||||
#[arg(long, default_value = "30")]
|
||||
poll: u16,
|
||||
/// connect or check timeout, in seconds
|
||||
#[arg(long, default_value = "5")]
|
||||
timeout: u16,
|
||||
/// target polling interval
|
||||
#[arg(long, default_value = "30s")]
|
||||
poll: Duration,
|
||||
/// connect or check timeout
|
||||
#[arg(long, default_value = "5s")]
|
||||
timeout: Duration,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -147,8 +147,8 @@ async fn main() -> Result<()> {
|
||||
} => Ok(dkl::proxy::Proxy {
|
||||
listen_addrs: listen,
|
||||
targets,
|
||||
poll: Duration::from_secs(poll.into()),
|
||||
timeout: Duration::from_secs(timeout.into()),
|
||||
poll: poll.into(),
|
||||
timeout: timeout.into(),
|
||||
}
|
||||
.run()
|
||||
.await
|
||||
|
||||
Reference in New Issue
Block a user