Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,165 changes: 902 additions & 263 deletions Cargo.lock

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ license = "MIT"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
dhcproto = { version = "0.12.0", features = ["serde"] }
dhcproto = { version = "0.15.0", features = ["serde"] }
anyhow = "1.0"
argh = "=0.1.7"
argh_derive = "=0.1.7"
crossbeam-channel = "0.5.1"
ctrlc = "3.1"
mac_address = "1.1.1"
tracing = "0.1"
tracing-subscriber = { version = "0.3.14", features = ["env-filter", "json"] }
rand = "0.8"
crossbeam-channel = "0.5.15"
ctrlc = "3.5.2"
mac_address = "1.1.8"
tracing = "0.1.44"
tracing-subscriber = { version = "0.3.23", features = ["env-filter", "json"] }
rand = "0.10.1"
hex = "0.4"
rhai = { version = "1.5.0", optional = true }
socket2 = { version = "0.5", features = ["all"] }
pnet_datalink = "0.31.0"
socket2 = { version = "0.6.3", features = ["all"] }
pnet_datalink = "0.35.0"
serde = "1.0"
serde_json = "1.0"
# rhai-rand = { version = "0.1", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion src/bootreq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ pub mod bootreq_mod {
}
#[rhai_fn(global, name = "to_string", name = "to_debug", pure)]
pub fn to_string(args: &mut BootReqArgs) -> String {
format!("{:?}", args)
format!("{args:?}")
}
// ciaddr
#[rhai_fn(global, get = "ciaddr", pure)]
Expand Down
2 changes: 1 addition & 1 deletion src/decline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ pub mod decline_mod {
}
#[rhai_fn(global, name = "to_string", name = "to_debug", pure)]
pub fn to_string(args: &mut DeclineArgs) -> String {
format!("{:?}", args)
format!("{args:?}")
}
// ciaddr
#[rhai_fn(global, get = "ciaddr", pure)]
Expand Down
2 changes: 1 addition & 1 deletion src/discover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ pub mod discover_mod {
}
#[rhai_fn(global, name = "to_string", name = "to_debug", pure)]
pub fn to_string(args: &mut DiscoverArgs) -> String {
format!("{:?}", args)
format!("{args:?}")
}
// ciaddr
#[rhai_fn(global, get = "ciaddr", pure)]
Expand Down
2 changes: 1 addition & 1 deletion src/inform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ pub mod inform_mod {
}
#[rhai_fn(global, name = "to_string", name = "to_debug", pure)]
pub fn to_string(args: &mut InformArgs) -> String {
format!("{:?}", args)
format!("{args:?}")
}
// ciaddr
#[rhai_fn(global, get = "ciaddr", pure)]
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ fn main() -> Result<()> {
.context("SO_BINDTODEVICE failed")?;
#[cfg(target_vendor = "apple")]
socket
.bind_device_by_index(std::num::NonZeroU32::new(int.index))
.bind_device_by_index_v4(std::num::NonZeroU32::new(int.index))
.context("IP_BOUND_IF")?;
if bind_addr.is_ipv6() && bind_addr.ip() == V6_MULTICAST {
socket
Expand Down Expand Up @@ -557,7 +557,7 @@ pub fn find_interface(interface: &Option<String>) -> Result<Option<NetworkInterf
match interface {
Some(interface) => match found_interfaces.iter().find(|i| &i.name == interface) {
Some(i) => Ok(Some(i.clone())),
None => bail!("unable to find interface {}", interface),
None => bail!("unable to find interface {interface}"),
},
None => Ok(None),
}
Expand Down
16 changes: 5 additions & 11 deletions src/opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,14 @@ pub fn get_mac() -> MacAddress {
.unwrap()
}

#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, PartialOrd, Ord)]
#[derive(Default, Copy, PartialOrd, Ord, Clone, PartialEq, Eq, Hash, Debug)]
pub enum LogStructure {
Debug,
#[default]
Pretty,
Json,
}

impl Default for LogStructure {
fn default() -> Self {
Self::Pretty
}
}

impl FromStr for LogStructure {
type Err = Error;
fn from_str(s: &str) -> Result<Self, Self::Err> {
Expand All @@ -47,8 +42,7 @@ impl FromStr for LogStructure {
"pretty" => Ok(LogStructure::Pretty),
"debug" => Ok(LogStructure::Debug),
_ => Err(anyhow!(
"unknown log structure type: {:?} must be \"json\" or \"compact\" or \"pretty\"",
s
"unknown log structure type: {s:?} must be \"json\" or \"compact\" or \"pretty\""
)),
}
}
Expand Down Expand Up @@ -153,9 +147,9 @@ pub fn parse_mac(mac: &str) -> Result<MacAddress, String> {
.collect::<Vec<String>>()
.join(":"),
)
.map_err(|_| format!("{:?}", err)),
.map_err(|_| format!("{err:?}")),
}
.map_err(|err| format!("{:?}", err)),
.map_err(|err| format!("{err:?}")),
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/release.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ pub mod release_mod {
}
#[rhai_fn(global, name = "to_string", name = "to_debug", pure)]
pub fn to_string(args: &mut ReleaseArgs) -> String {
format!("{:?}", args)
format!("{args:?}")
}
// ciaddr
#[rhai_fn(global, get = "ciaddr", pure)]
Expand Down
2 changes: 1 addition & 1 deletion src/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ pub mod request_mod {
}
#[rhai_fn(global, name = "to_string", name = "to_debug", pure)]
pub fn to_string(args: &mut RequestArgs) -> String {
format!("{:?}", args)
format!("{args:?}")
}
// ciaddr
#[rhai_fn(global, get = "ciaddr", pure)]
Expand Down
4 changes: 2 additions & 2 deletions src/script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ mod msg_mod {
}
#[rhai_fn(global, name = "to_string", name = "to_debug", pure)]
pub fn to_string(msg: &mut Msg) -> String {
format!("{:?}", msg)
format!("{msg:?}")
}
// '==' and '!=' operators
#[rhai_fn(global, name = "==", pure)]
Expand Down Expand Up @@ -83,7 +83,7 @@ mod v4_msg_mod {

#[rhai_fn(global, name = "to_string", name = "to_debug", pure)]
pub fn to_string(msg: &mut v4::Message) -> String {
format!("{:?}", msg)
format!("{msg:?}")
}
// '==' and '!=' operators
#[rhai_fn(global, name = "==", pure)]
Expand Down
Loading