diff --git a/Cargo.lock b/Cargo.lock index 6547621..63beddf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -24,9 +24,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.53" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94a45b455c14666b85fc40a019e8ab9eb75e3a124e05494f5397122bc9eb06e0" +checksum = "4361135be9122e0870de935d7c439aef945b9f9ddd4199a553b5270b49c82a27" [[package]] name = "atty" @@ -89,9 +89,9 @@ checksum = "fff857943da45f546682664a79488be82e69e43c1a7a2307679ab9afb3a66d2e" [[package]] name = "clap" -version = "3.1.0" +version = "3.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5f1fea81f183005ced9e59cdb01737ef2423956dac5a6d731b06b2ecfaa3467" +checksum = "d8c93436c21e4698bacadf42917db28b23017027a4deccb35dbe47a7e7840123" dependencies = [ "atty", "bitflags", @@ -106,18 +106,18 @@ dependencies = [ [[package]] name = "clap_complete" -version = "3.1.0" +version = "3.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23eec4dd324308f49d8bf86a2732078c34d57955fec1e1d865554fc37c15d420" +checksum = "df6f3613c0a3cddfd78b41b10203eb322cb29b600cbdf808a7d3db95691b8e25" dependencies = [ "clap", ] [[package]] name = "clap_derive" -version = "3.1.0" +version = "3.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fd1122e63869df2cb309f449da1ad54a7c6dfeb7c7e6ccd8e0825d9eb93bb72" +checksum = "da95d038ede1a964ce99f49cbe27a7fb538d1da595e4b4f70b8c8f338d17bf16" dependencies = [ "heck", "proc-macro-error", @@ -200,12 +200,11 @@ dependencies = [ [[package]] name = "dialoguer" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61579ada4ec0c6031cfac3f86fdba0d195a7ebeb5e36693bd53cb5999a25beeb" +checksum = "349d6b4fabcd9e97e1df1ae15395ac7e49fb144946a0d453959dc2696273b9da" dependencies = [ "console", - "lazy_static", ] [[package]] @@ -318,13 +317,13 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418d37c8b1d42553c93648be529cb70f920d3baf8ef469b74b9638df426e0b4c" +checksum = "d39cd93900197114fa1fcb7ae84ca742095eed9442088988ae74fa744e930e77" dependencies = [ "cfg-if", "libc", - "wasi", + "wasi 0.10.2+wasi-snapshot-preview1", ] [[package]] @@ -463,9 +462,9 @@ dependencies = [ [[package]] name = "indoc" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5a75aeaaef0ce18b58056d306c27b07436fbb34b8816c53094b76dd81803136" +checksum = "e7906a9fababaeacb774f72410e497a1d18de916322e33797bb2cd29baa23c9e" dependencies = [ "unindent", ] @@ -481,9 +480,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.3.1" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f2d64f2edebec4ce84ad108148e67e1064789bee435edc5b60ad398714a3a9" +checksum = "35e70ee094dc02fd9c13fdad4940090f22dbd6ac7c9e7094a46cf0232a50bc7c" dependencies = [ "serde", ] @@ -502,15 +501,15 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.118" +version = "0.2.120" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06e509672465a0504304aa87f9f176f2b2b716ed8fb105ebe5c02dc6dce96a94" +checksum = "ad5c14e80759d0939d013e6ca49930e59fc53dd8e5009132f76240c179380c09" [[package]] name = "libsqlite3-sys" -version = "0.23.2" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2cafc7c74096c336d9d27145f7ebd4f4b6f95ba16aa5a282387267e6925cb58" +checksum = "cb644c388dfaefa18035c12614156d285364769e818893da0dda9030c80ad2ba" dependencies = [ "pkg-config", "vcpkg", @@ -557,14 +556,15 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba272f85fa0b41fc91872be579b3bbe0f56b792aa361a380eb669469f68dafb2" +checksum = "7ba42135c6a5917b9db9cd7b293e5409e1c6b041e6f9825e92e55a894c63b6f8" dependencies = [ "libc", "log", "miow", "ntapi", + "wasi 0.11.0+wasi-snapshot-preview1", "winapi", ] @@ -579,9 +579,9 @@ dependencies = [ [[package]] name = "netlink-packet-core" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8349128e95f5dabcb8a18587ad06b3ca7993e90c0c360b4a2abac0313ebce727" +checksum = "345b8ab5bd4e71a2986663e88c56856699d060e78e152e6e9d7966fcd5491297" dependencies = [ "anyhow", "byteorder", @@ -604,9 +604,9 @@ dependencies = [ [[package]] name = "netlink-packet-route" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb5d54077de7c0904111e1d19b661b8cfccbc23d9ce5b6dbcc7362721e6e552" +checksum = "733ea73609acfd7fa7ddadfb7bf709b0471668c456ad9513685af543a06342b2" dependencies = [ "anyhow", "bitflags", @@ -618,9 +618,9 @@ dependencies = [ [[package]] name = "netlink-packet-utils" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a008a56eceb0cab06739c7f37f15bda27f1147a14d0e7136e8c913b94f1441d" +checksum = "25af9cf0dc55498b7bd94a1508af7a78706aa0ab715a73c5169273e03c84845e" dependencies = [ "anyhow", "byteorder", @@ -630,9 +630,9 @@ dependencies = [ [[package]] name = "netlink-packet-wireguard" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25b194380c9c965b12dcb745369056988f2f64ea495ef7f1e864e39cb4256992" +checksum = "ebc4ffa5ccfab369b38b5aed9dabe51b62b39bc9c80de7bd1213c5a8cdae03c4" dependencies = [ "anyhow", "byteorder", @@ -654,9 +654,9 @@ dependencies = [ [[package]] name = "netlink-sys" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed51a4602bb956eefef0ebc15f478bf9732fa3cc706e0a37112e654f41c5b92c" +checksum = "3e4c9f9547a08241bee7b6558b9b98e1f290d187de8b7cfca2bbb4937bcaa8f8" dependencies = [ "bytes", "libc", @@ -697,9 +697,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5" +checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9" [[package]] name = "os_str_bytes" @@ -836,18 +836,18 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" +checksum = "8380fe0152551244f0747b1bf41737e0f8a74f97a14ccefd1148187271634f3c" dependencies = [ "bitflags", ] [[package]] name = "regex" -version = "1.5.4" +version = "1.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" +checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286" dependencies = [ "aho-corasick", "memchr", @@ -871,9 +871,9 @@ dependencies = [ [[package]] name = "rusqlite" -version = "0.26.3" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ba4d3462c8b2e4d7f4fcfcf2b296dc6b65404fbbc7b63daa37fd485c149daf7" +checksum = "85127183a999f7db96d1a976a309eebbfb6ea3b0b400ddd8340190129de6eb7a" dependencies = [ "bitflags", "fallible-iterator", @@ -1019,9 +1019,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" -version = "1.0.86" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a65b3f4ffa0092e9887669db0eae07941f023991ab58ea44da8fe8e2d511c6b" +checksum = "1e59d925cf59d8151f25a3bedf97c9c157597c9df7324d32d68991cc399ed08b" dependencies = [ "proc-macro2", "quote", @@ -1044,9 +1044,9 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" +checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" dependencies = [ "winapi-util", ] @@ -1063,9 +1063,9 @@ dependencies = [ [[package]] name = "textwrap" -version = "0.14.2" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0066c8d12af8b5acd21e00547c3797fde4e8677254a7ee429176ccebbe93dd80" +checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" [[package]] name = "thiserror" @@ -1145,9 +1145,9 @@ checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" [[package]] name = "tracing" -version = "0.1.30" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d8d93354fe2a8e50d5953f5ae2e47a3fc2ef03292e7ea46e3cc38f549525fb9" +checksum = "4a1bdf54a7c28a2bbf701e1d2233f6c77f473486b94bee4f9678da5a148dca7f" dependencies = [ "cfg-if", "pin-project-lite", @@ -1156,9 +1156,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03cfcb51380632a72d3111cb8d3447a8d908e577d31beeac006f836383d29a23" +checksum = "aa31669fa42c09c34d94d8165dd2012e8ff3c66aca50f3bb226b68f216f2706c" dependencies = [ "lazy_static", ] @@ -1204,9 +1204,9 @@ checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" [[package]] name = "unindent" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f14ee04d9415b52b3aeab06258a3f07093182b88ba0f9b8d203f211a7a7d41c7" +checksum = "514672a55d7380da379785a4d70ca8386c8883ff7eaae877be4d2081cebe73d8" [[package]] name = "ureq" @@ -1263,6 +1263,12 @@ version = "0.10.2+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + [[package]] name = "winapi" version = "0.3.9" diff --git a/client/Cargo.toml b/client/Cargo.toml index dc8afcf..58decee 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -18,10 +18,10 @@ anyhow = "1" colored = "2" clap = { version = "3", features = ["derive"] } clap_complete = "3" -dialoguer = { version = "0.9", default-features = false } +dialoguer = { version = "0.10", default-features = false } hostsfile = { path = "../hostsfile" } indoc = "1" -ipnet = { version = "2", features = ["serde"] } +ipnet = { version = "2.4", features = ["serde"] } lazy_static = "1" log = "0.4" regex = { version = "1", default-features = false, features = ["std"] } diff --git a/netlink-request/Cargo.toml b/netlink-request/Cargo.toml index eb86307..3877963 100644 --- a/netlink-request/Cargo.toml +++ b/netlink-request/Cargo.toml @@ -7,4 +7,4 @@ edition = "2021" netlink-sys = "0.8" netlink-packet-core = "0.4" netlink-packet-generic = "0.3" -netlink-packet-route = "0.10" +netlink-packet-route = "0.11" diff --git a/server/Cargo.toml b/server/Cargo.toml index be62fee..ec932c3 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -21,19 +21,19 @@ bytes = "1" clap = { version = "3", features = ["derive"] } clap_complete = "3" colored = "2" -dialoguer = { version = "0.9", default-features = false } +dialoguer = { version = "0.10", default-features = false } hyper = { version = "0.14", default-features = false, features = ["http1", "server", "runtime", "stream"] } indoc = "1" -ipnet = { version = "2", features = ["serde"] } +ipnet = { version = "2.4", features = ["serde"] } lazy_static = "1" libc = "0.2" -libsqlite3-sys = "0.23" +libsqlite3-sys = "0.24" log = "0.4" parking_lot = "0.12" pretty_env_logger = "0.4" publicip = { path = "../publicip" } regex = { version = "1", default-features = false, features = ["std"] } -rusqlite = "0.26" +rusqlite = "0.27" serde = { version = "1", features = ["derive"] } serde_json = "1" shared = { path = "../shared" } diff --git a/server/src/db/cidr.rs b/server/src/db/cidr.rs index cbbdf78..924f054 100644 --- a/server/src/db/cidr.rs +++ b/server/src/db/cidr.rs @@ -1,7 +1,7 @@ use crate::ServerError; use ipnet::IpNet; use rusqlite::{params, Connection}; -use shared::{Cidr, CidrContents, IpNetExt}; +use shared::{Cidr, CidrContents}; use std::ops::Deref; pub static CREATE_TABLE_SQL: &str = "CREATE TABLE cidrs ( diff --git a/server/src/main.rs b/server/src/main.rs index e45d206..cd26d75 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -9,7 +9,7 @@ use parking_lot::{Mutex, RwLock}; use rusqlite::Connection; use serde::{Deserialize, Serialize}; use shared::{ - get_local_addrs, AddCidrOpts, AddPeerOpts, DeleteCidrOpts, Endpoint, IoErrorContext, IpNetExt, + get_local_addrs, AddCidrOpts, AddPeerOpts, DeleteCidrOpts, Endpoint, IoErrorContext, NetworkOpts, PeerContents, RenamePeerOpts, INNERNET_PUBKEY_HEADER, }; use std::{ diff --git a/shared/Cargo.toml b/shared/Cargo.toml index fa38eec..155c12e 100644 --- a/shared/Cargo.toml +++ b/shared/Cargo.toml @@ -11,9 +11,9 @@ anyhow = "1" atty = "0.2" clap = { version = "3", features = ["derive"] } colored = "2.0" -dialoguer = { version = "0.9", default-features = false } +dialoguer = { version = "0.10", default-features = false } indoc = "1" -ipnet = { version = "2", features = ["serde"] } +ipnet = { version = "2.4", features = ["serde"] } lazy_static = "1" libc = "0.2" log = "0.4" @@ -27,7 +27,7 @@ wireguard-control = { path = "../wireguard-control" } [target.'cfg(target_os = "linux")'.dependencies] netlink-sys = "0.8" netlink-packet-core = "0.4" -netlink-packet-route = "0.10" +netlink-packet-route = "0.11" netlink-request = { path = "../netlink-request" } [target.'cfg(target_os = "macos")'.dependencies] diff --git a/shared/src/lib.rs b/shared/src/lib.rs index 8ff00a3..ec5ec40 100644 --- a/shared/src/lib.rs +++ b/shared/src/lib.rs @@ -1,5 +1,5 @@ pub use anyhow::Error; -use ipnet::{IpNet, Ipv4Net, Ipv6Net, PrefixLenError}; +use ipnet::{IpNet}; use std::{ fs::{self, File, Permissions}, io, @@ -120,19 +120,9 @@ pub fn get_local_addrs() -> Result, io::E pub trait IpNetExt { fn is_assignable(&self, ip: &IpAddr) -> bool; - - #[allow(clippy::new_ret_no_self)] - fn new(ip: IpAddr, prefix_len: u8) -> Result; } impl IpNetExt for IpNet { - fn new(ip: IpAddr, prefix_len: u8) -> Result { - Ok(match ip { - IpAddr::V4(a) => Ipv4Net::new(a, prefix_len)?.into(), - IpAddr::V6(a) => Ipv6Net::new(a, prefix_len)?.into(), - }) - } - fn is_assignable(&self, ip: &IpAddr) -> bool { self.contains(ip) && match self { diff --git a/wireguard-control/Cargo.toml b/wireguard-control/Cargo.toml index 592d05b..e976ef8 100644 --- a/wireguard-control/Cargo.toml +++ b/wireguard-control/Cargo.toml @@ -22,5 +22,5 @@ netlink-request = { path = "../netlink-request" } netlink-sys = "0.8" netlink-packet-core = "0.4" netlink-packet-generic = "0.3" -netlink-packet-route = "0.10" +netlink-packet-route = "0.11" netlink-packet-wireguard = "0.2"