diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e53ab4..29cc1f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,10 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [0.5.0] 2023-12-30 ### Changed - Adopt anyhow and thiserror instead of failure - Start a modularization work to build a pot crate +- Make DNS configuration optional (#51) ## [0.4.4] 2020-03-31 ### Fixed diff --git a/Cargo.lock b/Cargo.lock index e95a2ac..4773882 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -28,9 +28,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.75" +version = "1.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +checksum = "c9d19de80eff169429ac1e9f48fffb163916b448a44e8e046186232046d9e1f9" [[package]] name = "atty" @@ -84,9 +84,9 @@ dependencies = [ [[package]] name = "cargo-platform" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e34637b3140142bdf929fb439e8aa4ebad7651ebf7b1080b3930aa16ac1459ff" +checksum = "ceed8ef69d8518a5dda55c07425450b58a4e1946f4951eab6d7191ee86c2443d" dependencies = [ "serde", ] @@ -194,7 +194,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys", ] [[package]] @@ -249,9 +249,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.58" +version = "0.1.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" +checksum = "b6a67363e2aa4443928ce15e57ebae94fd8949958fd1223c4cfc0cd473ad7539" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -337,9 +337,9 @@ checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "memchr" -version = "2.6.4" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "mocktopus" @@ -387,7 +387,7 @@ dependencies = [ [[package]] name = "potnet" -version = "0.4.4" +version = "0.5.0" dependencies = [ "anyhow", "ipnet", @@ -427,9 +427,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.70" +version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" +checksum = "75cb1540fadbd5b8fbccc4dddad2734eba435053f725621c070711a14bb5f4b8" dependencies = [ "unicode-ident", ] @@ -484,7 +484,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys 0.52.0", + "windows-sys", ] [[package]] @@ -528,7 +528,7 @@ checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.43", ] [[package]] @@ -623,9 +623,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.41" +version = "2.0.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44c8b28c477cc3bf0e7966561e3460130e1255f7a1cf71931075f1c5e7a7e269" +checksum = "ee659fb5f3d355364e1f3e5bc10fb82068efbf824a1e9d1c9504244a6469ad53" dependencies = [ "proc-macro2", "quote", @@ -634,15 +634,15 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.8.1" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" +checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" dependencies = [ "cfg-if 1.0.0", "fastrand", "redox_syscall", "rustix", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -681,7 +681,7 @@ checksum = "e7fbe9b594d6568a6a1443250a7e67d80b74e1e96f6d1715e1e21cc1888291d3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.43", ] [[package]] @@ -760,7 +760,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.43", "wasm-bindgen-shared", ] @@ -782,7 +782,7 @@ checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.43", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -826,20 +826,11 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-core" -version = "0.51.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" -dependencies = [ - "windows-targets 0.48.5", -] - -[[package]] -name = "windows-sys" -version = "0.48.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.48.5", + "windows-targets 0.52.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index b8d3d26..1a1ce1f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "potnet" -version = "0.4.4" +version = "0.5.0" authors = ["Luca Pizzamiglio "] -edition = "2018" +edition = "2021" categories = ["command-line-interface"] keywords = ["FreeBSD"] repository = "https://github.com/pizzamig/potnet" diff --git a/pot/Cargo.toml b/pot/Cargo.toml index 5380df3..182b587 100644 --- a/pot/Cargo.toml +++ b/pot/Cargo.toml @@ -2,7 +2,7 @@ name = "pot-rs" version = "0.5.0" authors = ["Luca Pizzamiglio "] -edition = "2018" +edition = "2021" keywords = ["FreeBSD"] description = "Utility modules and functions useful to interact with the pot framework" readme = "README.md" diff --git a/pot/src/system.rs b/pot/src/system.rs index 3086dc4..22cda9a 100644 --- a/pot/src/system.rs +++ b/pot/src/system.rs @@ -32,7 +32,7 @@ impl PartialSystemConf { Err(_) => return dconf, }; let pconf = PartialSystemConf::from_str(&s).ok().unwrap_or_default(); - let pconf_has_dns_ip = pconf.dns_ip != None; + let pconf_has_dns_ip = pconf.dns_ip.is_some(); dconf.merge(pconf); // remove dns_ip if it came from default config and is not inside pot network if !pconf_has_dns_ip { @@ -234,7 +234,7 @@ mod tests { assert!(uut.is_ok()); let uut = uut.unwrap(); assert!(!uut.is_valid()); - assert!(!uut.network.is_some()); + assert!(uut.network.is_none()); } #[test] diff --git a/src/bin/potcpu.rs b/src/bin/potcpu.rs index c4778a6..d2c3b7f 100644 --- a/src/bin/potcpu.rs +++ b/src/bin/potcpu.rs @@ -56,9 +56,7 @@ fn allocation_from_utf8(v: &[u8]) -> Result { let result: Allocation = mask .split(',') .map(str::trim) - .map(str::parse) - .filter(std::result::Result::is_ok) - .map(std::result::Result::unwrap) + .flat_map(str::parse) .collect(); Ok(result) }