Skip to content

Commit

Permalink
start testing notify!
Browse files Browse the repository at this point in the history
  • Loading branch information
tertsdiepraam committed Nov 20, 2024
1 parent 2538723 commit 53c7b53
Show file tree
Hide file tree
Showing 9 changed files with 994 additions and 63 deletions.
562 changes: 562 additions & 0 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ path = "src/bin/ldns.rs"
[dependencies]
bytes = "1.8.0"
chrono = "0.4.38"
# domain = { version = "0.10.3", git = "https://github.com/NLnetLabs/domain.git", features = ["tsig", "zonefile", "bytes", "validate", "resolv", "net", "unstable-client-transport"] }
clap = { version = "4.3.4", features = ["derive"] }
domain = { version = "0.10.3", git = "https://github.com/NLnetLabs/domain.git", features = [
"zonefile",
"bytes",
"unstable-validate",
"net",
"unstable-client-transport",
"tsig",
"resolv",
] }
lexopt = "0.3.0"
tokio = "1.40.0"
Expand All @@ -27,3 +30,4 @@ ring = { version = "0.17" }

[dev-dependencies]
tempfile = "3.14.0"
domain = { version = "*", git = "https://github.com/NLnetLabs/domain.git", features = ["unstable-stelline"] }
6 changes: 3 additions & 3 deletions src/commands/key2ds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,9 @@ mod test {
use super::Key2ds;

#[track_caller]
fn parse(args: FakeCmd) -> Key2ds {
let res = args.parse();
let Command::Key2ds(x) = res.unwrap().command else {
fn parse(cmd: FakeCmd) -> Key2ds {
let res = cmd.parse().unwrap();
let Command::Key2ds(x) = res.command else {
panic!("Not a Key2ds!");
};
x
Expand Down
8 changes: 8 additions & 0 deletions src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ use std::ffi::{OsStr, OsString};
use std::str::FromStr;

use key2ds::Key2ds;
use notify::Notify;
use nsec3hash::Nsec3Hash;

use crate::env::Env;
use crate::Args;

use super::error::Error;

#[allow(clippy::large_enum_variant)]
#[derive(Clone, Debug, clap::Subcommand)]
pub enum Command {
/// Print the NSEC3 hash of a given domain name
Expand Down Expand Up @@ -86,6 +88,12 @@ impl From<Key2ds> for Command {
}
}

impl From<Notify> for Command {
fn from(val: Notify) -> Self {
Command::Notify(val)
}
}

/// Utility function to parse an [`OsStr`] with a custom function
fn parse_os_with<T, E>(opt: &str, val: &OsStr, f: impl Fn(&str) -> Result<T, E>) -> Result<T, Error>
where
Expand Down
Loading

0 comments on commit 53c7b53

Please sign in to comment.