use human_units for Duration params
This commit is contained in:
16
Cargo.lock
generated
16
Cargo.lock
generated
@ -279,6 +279,7 @@ dependencies = [
|
||||
"futures-util",
|
||||
"glob",
|
||||
"hex",
|
||||
"human-units",
|
||||
"log",
|
||||
"lz4",
|
||||
"nix",
|
||||
@ -586,6 +587,15 @@ version = "1.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87"
|
||||
|
||||
[[package]]
|
||||
name = "human-units"
|
||||
version = "0.5.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "47cf34dbcbbb7f1f6589c18e26f15a5a72592750dd5472037eb78fc0f92020d4"
|
||||
dependencies = [
|
||||
"paste",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hyper"
|
||||
version = "1.8.1"
|
||||
@ -1059,6 +1069,12 @@ dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "paste"
|
||||
version = "1.0.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
|
||||
|
||||
[[package]]
|
||||
name = "percent-encoding"
|
||||
version = "2.3.2"
|
||||
|
||||
@ -24,6 +24,7 @@ futures = "0.3.31"
|
||||
futures-util = "0.3.31"
|
||||
glob = "0.3.2"
|
||||
hex = "0.4.3"
|
||||
human-units = "0.5.3"
|
||||
log = "0.4.27"
|
||||
lz4 = "1.28.1"
|
||||
nix = { version = "0.30.1", features = ["user"] }
|
||||
|
||||
@ -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