From fa43bea359388f15b9d4dfba9fd4f1a3afef4e20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Laitl?= Date: Fri, 24 Feb 2023 18:23:23 +0100 Subject: [PATCH 01/16] Add `Actively Maintained` and `MIT` license badges to README The maintenance badge leads to https://gist.github.com/cheerfulstoic/d107229326a01ff0f333a1d3476e068d _Actively Maintained_ is described there as > The maintainer(s) of this project are responding to issues and integrating code contributions ...which should set the correct expectations for people stumbling upon. Not explicitly said, but I count that also means we'll be doing (minor, mostly) releases. --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 21bd2cd0..cbddebe1 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # innernet +[![Actively Maintained](https://img.shields.io/badge/Maintenance%20Level-Actively%20Maintained-green.svg)](https://gist.github.com/cheerfulstoic/d107229326a01ff0f333a1d3476e068d) +[![MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/tonarino/innernet/blob/master/LICENSE) + A private network system that uses [WireGuard](https://wireguard.com) under the hood. See the [announcement blog post](https://blog.tonari.no/introducing-innernet) for a longer-winded explanation. From 55beed3c2d09813f150ded5bc1aeaa7f6ce5ab44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Laitl?= Date: Mon, 27 Mar 2023 14:43:56 +0200 Subject: [PATCH 02/16] Remove extraneous into_iter() (clippy 1.68 fix) https://doc.rust-lang.org/std/fs/fn.read_dir.html already returns an Iterator (`ReadDir`s IntoIter implementation returns `self`) --- client/src/util.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/client/src/util.rs b/client/src/util.rs index edf365e8..72112b13 100644 --- a/client/src/util.rs +++ b/client/src/util.rs @@ -172,9 +172,7 @@ pub fn print_peer_diff(store: &DataStore, diff: &PeerDiff) { pub fn all_installed(config_dir: &Path) -> Result, std::io::Error> { // All errors are bubbled up when enumerating a directory - let entries: Vec<_> = std::fs::read_dir(config_dir)? - .into_iter() - .collect::>()?; + let entries: Vec<_> = std::fs::read_dir(config_dir)?.collect::>()?; let installed: Vec<_> = entries .into_iter() From b4df350b1c9a956aa19ff4e3baf6ce41d8065f19 Mon Sep 17 00:00:00 2001 From: Jake McGinty Date: Fri, 14 Apr 2023 13:07:07 -0700 Subject: [PATCH 03/16] meta: update jake's email address --- client/Cargo.toml | 2 +- server/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/Cargo.toml b/client/Cargo.toml index 4e63c7f1..9e94416e 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -1,5 +1,5 @@ [package] -authors = ["Jake McGinty "] +authors = ["Jake McGinty "] description = "A client to manage innernet network interfaces." edition = "2021" homepage = "https://github.com/tonarino/innernet" diff --git a/server/Cargo.toml b/server/Cargo.toml index 555ae48e..31eec0af 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -1,5 +1,5 @@ [package] -authors = ["Jake McGinty "] +authors = ["Jake McGinty "] description = "A server to coordinate innernet networks." edition = "2021" license = "MIT" From ae96e05e903a9946f9da4579baac11fef7ad9ecf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Laitl?= Date: Mon, 22 May 2023 10:37:39 +0200 Subject: [PATCH 04/16] Link @tommie's Debian/Ubuntu build repo from README Per https://github.com/tonarino/innernet/issues/203#issuecomment-1556708337 --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cbddebe1..8bd30fa0 100644 --- a/README.md +++ b/README.md @@ -198,9 +198,13 @@ It's assumed that WireGuard is installed on your system, either via the kernel m pacman -S innernet ``` +### Debian and Ubuntu + +[**@tommie**](https://github.com/tommie) is kindly providing Debian/Ubuntu innernet builds in the https://github.com/tommie/innernet-debian repository. + ### Other Linux Distributions -Starting with the 1.5.4 release, Debian and RPM packages are no longer built in this repository. We're looking for volunteers who are able to set up external builds for popular distributions. Please see issue [#203](https://github.com/tonarino/innernet/issues/203). +We're looking for volunteers who are able to set up external builds for popular distributions. Please see issue [#203](https://github.com/tonarino/innernet/issues/203). ### macOS From f67457e0a4e3ecba18a3add41f5a6b384af61fa2 Mon Sep 17 00:00:00 2001 From: Ryan Gonzalez Date: Sat, 27 May 2023 16:59:32 -0500 Subject: [PATCH 05/16] Use the proper netlink buffer size with large kernel pages The recommended netlink buffer size is based on the system's page size, which means that the current size is far too small for systems with 16k or 64k pages, such as Asahi Linux or RHEL's kernel-64k for ARM64. On these systems, the server fails to start with errors like this: Error: Decode error occurred: invalid netlink buffer: length field says 1444 the buffer is 1260 bytes long Instead, follow the kernel's own netlink docs to compute the buffer size. The approach here matches the approach merged into Chromium recently: https://chromium-review.googlesource.com/c/chromium/src/+/4312885 --- Cargo.lock | 6 ++-- netlink-request/Cargo.toml | 2 ++ netlink-request/src/lib.rs | 37 ++++++++++++++++++------ wireguard-control/src/backends/kernel.rs | 18 +++++++----- 4 files changed, 45 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index be6264ef..97f70697 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -624,6 +624,8 @@ dependencies = [ "netlink-packet-generic", "netlink-packet-route", "netlink-sys", + "nix", + "once_cell", ] [[package]] @@ -663,9 +665,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.0" +version = "1.17.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" +checksum = "9670a07f94779e00908f3e686eab508878ebb390ba6e604d3a284c00e8d0487b" [[package]] name = "os_str_bytes" diff --git a/netlink-request/Cargo.toml b/netlink-request/Cargo.toml index 0235e31b..71ee7032 100644 --- a/netlink-request/Cargo.toml +++ b/netlink-request/Cargo.toml @@ -8,3 +8,5 @@ netlink-sys = "0.8" netlink-packet-core = "0.4" netlink-packet-generic = "0.3" netlink-packet-route = "0.13" +nix = { version = "0.25", features = ["feature"] } +once_cell = "1" diff --git a/netlink-request/src/lib.rs b/netlink-request/src/lib.rs index 152a1527..686498eb 100644 --- a/netlink-request/src/lib.rs +++ b/netlink-request/src/lib.rs @@ -1,9 +1,5 @@ #[cfg(target_os = "linux")] mod linux { - pub const MAX_NETLINK_BUFFER_LENGTH: usize = 4096; - pub const MAX_GENL_PAYLOAD_LENGTH: usize = - MAX_NETLINK_BUFFER_LENGTH - NETLINK_HEADER_LEN - GENL_HDRLEN; - use netlink_packet_core::{ NetlinkDeserializable, NetlinkMessage, NetlinkPayload, NetlinkSerializable, NETLINK_HEADER_LEN, NLM_F_ACK, NLM_F_CREATE, NLM_F_EXCL, NLM_F_REQUEST, @@ -15,6 +11,8 @@ mod linux { }; use netlink_packet_route::RtnlMessage; use netlink_sys::{constants::NETLINK_GENERIC, protocols::NETLINK_ROUTE, Socket}; + use nix::unistd::{sysconf, SysconfVar}; + use once_cell::sync::OnceCell; use std::{fmt::Debug, io}; macro_rules! get_nla_value { @@ -26,6 +24,26 @@ mod linux { }; } + pub fn max_netlink_buffer_length() -> usize { + static LENGTH: OnceCell = OnceCell::new(); + *LENGTH.get_or_init(|| { + // https://www.kernel.org/doc/html/v6.2/userspace-api/netlink/intro.html#buffer-sizing + // "Netlink expects that the user buffer will be at least 8kB or a page + // size of the CPU architecture, whichever is bigger." + const MIN_NELINK_BUFFER_LENGTH: usize = 8 * 1024; + // Note that sysconf only returns Err / Ok(None) when the parameter is + // invalid, unsupported on the current OS, or an unset limit. PAGE_SIZE + // is *required* to be supported and is not considered a limit, so this + // should never fail unless something has gone massively wrong. + let page_size = sysconf(SysconfVar::PAGE_SIZE).unwrap().unwrap() as usize; + std::cmp::max(MIN_NELINK_BUFFER_LENGTH, page_size) + }) + } + + pub fn max_genl_payload_length() -> usize { + max_netlink_buffer_length() - NETLINK_HEADER_LEN - GENL_HDRLEN + } + pub fn netlink_request_genl( mut message: GenlMessage, flags: Option, @@ -84,13 +102,14 @@ mod linux { { let mut req = NetlinkMessage::from(message); - if req.buffer_len() > MAX_NETLINK_BUFFER_LENGTH { + let max_buffer_len = max_netlink_buffer_length(); + if req.buffer_len() > max_buffer_len { return Err(io::Error::new( io::ErrorKind::InvalidInput, format!( "Serialized netlink packet ({} bytes) larger than maximum size {}: {:?}", req.buffer_len(), - MAX_NETLINK_BUFFER_LENGTH, + max_buffer_len, req ), )); @@ -98,7 +117,7 @@ mod linux { req.header.flags = flags.unwrap_or(NLM_F_REQUEST | NLM_F_ACK | NLM_F_EXCL | NLM_F_CREATE); req.finalize(); - let mut buf = [0; MAX_NETLINK_BUFFER_LENGTH]; + let mut buf = vec![0; max_buffer_len]; req.serialize(&mut buf); let len = req.buffer_len(); @@ -141,6 +160,6 @@ mod linux { #[cfg(target_os = "linux")] pub use linux::{ - netlink_request, netlink_request_genl, netlink_request_rtnl, MAX_GENL_PAYLOAD_LENGTH, - MAX_NETLINK_BUFFER_LENGTH, + max_genl_payload_length, max_netlink_buffer_length, netlink_request, netlink_request_genl, + netlink_request_rtnl, }; diff --git a/wireguard-control/src/backends/kernel.rs b/wireguard-control/src/backends/kernel.rs index bf7edafa..9c60bf10 100644 --- a/wireguard-control/src/backends/kernel.rs +++ b/wireguard-control/src/backends/kernel.rs @@ -21,7 +21,7 @@ use netlink_packet_wireguard::{ nlas::{WgAllowedIp, WgAllowedIpAttrs, WgDeviceAttrs, WgPeer, WgPeerAttrs}, Wireguard, WireguardCmd, }; -use netlink_request::{netlink_request_genl, netlink_request_rtnl, MAX_GENL_PAYLOAD_LENGTH}; +use netlink_request::{max_genl_payload_length, netlink_request_genl, netlink_request_rtnl}; use std::{convert::TryFrom, io}; @@ -285,13 +285,15 @@ impl ApplyPayload { /// Push a device attribute which will be optimally packed into 1 or more netlink messages pub fn push(&mut self, nla: WgDeviceAttrs) -> io::Result<()> { + let max_payload_len = max_genl_payload_length(); + let nla_buffer_len = nla.buffer_len(); - if (self.current_buffer_len + nla_buffer_len) > MAX_GENL_PAYLOAD_LENGTH { + if (self.current_buffer_len + nla_buffer_len) > max_payload_len { self.flush_nlas(); } // If the NLA *still* doesn't fit... - if (self.current_buffer_len + nla_buffer_len) > MAX_GENL_PAYLOAD_LENGTH { + if (self.current_buffer_len + nla_buffer_len) > max_payload_len { return Err(io::Error::new( io::ErrorKind::InvalidInput, format!("encoded NLA ({nla_buffer_len} bytes) is too large: {nla:?}"), @@ -305,6 +307,7 @@ impl ApplyPayload { /// A helper function to assist in breaking up large peer lists across multiple netlink messages pub fn push_peer(&mut self, peer: WgPeer) -> io::Result<()> { const EMPTY_PEERS: WgDeviceAttrs = WgDeviceAttrs::Peers(vec![]); + let max_payload_len = max_genl_payload_length(); let mut needs_peer_nla = !self .nlas .iter() @@ -314,7 +317,7 @@ impl ApplyPayload { if needs_peer_nla { additional_buffer_len += EMPTY_PEERS.buffer_len(); } - if (self.current_buffer_len + additional_buffer_len) > MAX_GENL_PAYLOAD_LENGTH { + if (self.current_buffer_len + additional_buffer_len) > max_payload_len { self.flush_nlas(); needs_peer_nla = true; } @@ -324,7 +327,7 @@ impl ApplyPayload { } // If the peer *still* doesn't fit... - if (self.current_buffer_len + peer_buffer_len) > MAX_GENL_PAYLOAD_LENGTH { + if (self.current_buffer_len + peer_buffer_len) > max_payload_len { return Err(io::Error::new( io::ErrorKind::InvalidInput, format!("encoded peer ({peer_buffer_len} bytes) is too large: {peer:?}"), @@ -397,7 +400,7 @@ pub fn delete_interface(iface: &InterfaceName) -> io::Result<()> { mod tests { use super::*; use netlink_packet_wireguard::nlas::WgAllowedIp; - use netlink_request::MAX_NETLINK_BUFFER_LENGTH; + use netlink_request::max_netlink_buffer_length; use std::str::FromStr; #[test] @@ -455,8 +458,9 @@ mod tests { let messages = payload.finish(); println!("generated {} messages", messages.len()); assert!(messages.len() > 1); + let max_buffer_len = max_netlink_buffer_length(); for message in messages { - assert!(NetlinkMessage::from(message).buffer_len() <= MAX_NETLINK_BUFFER_LENGTH); + assert!(NetlinkMessage::from(message).buffer_len() <= max_buffer_len); } } } From ebeac3db76778518b1a94a1e7b85037565b12196 Mon Sep 17 00:00:00 2001 From: Jake McGinty Date: Tue, 30 May 2023 01:34:44 -0500 Subject: [PATCH 06/16] migrate from lazy_static to once_cell across project --- Cargo.lock | 6 +++--- client/Cargo.toml | 2 +- client/src/data_store.rs | 22 ++++++++++++---------- server/Cargo.toml | 2 +- server/src/api/mod.rs | 2 +- server/src/db/peer.rs | 10 ++++------ shared/Cargo.toml | 2 +- shared/src/prompts.rs | 6 ++---- shared/src/types.rs | 10 ++++------ 9 files changed, 29 insertions(+), 33 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 97f70697..425713a4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -141,8 +141,8 @@ dependencies = [ "hostsfile", "indoc", "ipnet", - "lazy_static", "log", + "once_cell", "regex", "serde", "serde_json", @@ -920,10 +920,10 @@ dependencies = [ "hyper", "indoc", "ipnet", - "lazy_static", "libc", "libsqlite3-sys", "log", + "once_cell", "parking_lot", "pretty_env_logger", "publicip", @@ -953,7 +953,6 @@ dependencies = [ "dialoguer", "indoc", "ipnet", - "lazy_static", "libc", "log", "netlink-packet-core", @@ -961,6 +960,7 @@ dependencies = [ "netlink-request", "netlink-sys", "nix", + "once_cell", "publicip", "regex", "serde", diff --git a/client/Cargo.toml b/client/Cargo.toml index 9e94416e..1c16c40b 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -22,7 +22,6 @@ dialoguer = { version = "0.10", default-features = false } hostsfile = { path = "../hostsfile" } indoc = "1" ipnet = { version = "2.4", features = ["serde"] } -lazy_static = "1" log = "0.4" regex = { version = "1", default-features = false, features = ["std"] } serde = { version = "1.0", features = ["derive"] } @@ -32,6 +31,7 @@ ureq = { version = "2", default-features = false, features = ["json"] } wireguard-control = { path = "../wireguard-control" } [dev-dependencies] +once_cell = "1.17.1" tempfile = "3" [package.metadata.deb] diff --git a/client/src/data_store.rs b/client/src/data_store.rs index f15d0248..20efc47d 100644 --- a/client/src/data_store.rs +++ b/client/src/data_store.rs @@ -144,10 +144,10 @@ impl DataStore { #[cfg(test)] mod tests { use super::*; - use lazy_static::lazy_static; + use once_cell::sync::Lazy; use shared::{Cidr, CidrContents, Peer, PeerContents}; - lazy_static! { - static ref BASE_PEERS: Vec = vec![Peer { + static BASE_PEERS: Lazy> = Lazy::new(|| { + vec![Peer { id: 0, contents: PeerContents { name: "blah".parse().unwrap(), @@ -161,17 +161,19 @@ mod tests { persistent_keepalive_interval: None, invite_expires: None, candidates: vec![], - } - }]; - static ref BASE_CIDRS: Vec = vec![Cidr { + }, + }] + }); + static BASE_CIDRS: Lazy> = Lazy::new(|| { + vec![Cidr { id: 1, contents: CidrContents { name: "cidr".to_string(), cidr: "10.0.0.0/24".parse().unwrap(), - parent: None - } - }]; - } + parent: None, + }, + }] + }); fn setup_basic_store(dir: &Path) { let mut store = DataStore::open_with_path(dir.join("peer_store.json"), true).unwrap(); diff --git a/server/Cargo.toml b/server/Cargo.toml index 31eec0af..d7676dd5 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -25,10 +25,10 @@ dialoguer = { version = "0.10", default-features = false } hyper = { version = "0.14", default-features = false, features = ["http1", "server", "runtime", "stream"] } indoc = "1" ipnet = { version = "2.4", features = ["serde"] } -lazy_static = "1" libc = "0.2" libsqlite3-sys = "0.25" log = "0.4" +once_cell = "1.17.1" parking_lot = "0.12" pretty_env_logger = "0.4" publicip = { path = "../publicip" } diff --git a/server/src/api/mod.rs b/server/src/api/mod.rs index afed99e5..f7db98ff 100644 --- a/server/src/api/mod.rs +++ b/server/src/api/mod.rs @@ -8,7 +8,7 @@ pub mod user; /// Inject the collected endpoints from the WG interface into a list of peers. /// This is essentially what adds NAT holepunching functionality. pub fn inject_endpoints(session: &Session, peers: &mut Vec) { - for mut peer in peers { + for peer in peers { if peer.contents.endpoint.is_none() { if let Some(endpoint) = session.context.endpoints.read().get(&peer.public_key) { peer.contents.endpoint = Some(endpoint.to_owned().into()); diff --git a/server/src/db/peer.rs b/server/src/db/peer.rs index c14c84c1..1dd6b40f 100644 --- a/server/src/db/peer.rs +++ b/server/src/db/peer.rs @@ -1,6 +1,6 @@ use super::DatabaseCidr; use crate::ServerError; -use lazy_static::lazy_static; +use once_cell::sync::Lazy; use regex::Regex; use rusqlite::{params, types::Type, Connection}; use shared::{IpNetExt, Peer, PeerContents, PERSISTENT_KEEPALIVE_INTERVAL_SECS}; @@ -42,11 +42,9 @@ pub static COLUMNS: &[&str] = &[ "candidates", ]; -lazy_static! { - /// Regex to match the requirements of hostname(7), needed to have peers also be reachable hostnames. - /// Note that the full length also must be maximum 63 characters, which this regex does not check. - static ref PEER_NAME_REGEX: Regex = Regex::new(r"^([a-z0-9]-?)*[a-z0-9]$").unwrap(); -} +/// Regex to match the requirements of hostname(7), needed to have peers also be reachable hostnames. +/// Note that the full length also must be maximum 63 characters, which this regex does not check. +static PEER_NAME_REGEX: Lazy = Lazy::new(|| Regex::new(r"^([a-z0-9]-?)*[a-z0-9]$").unwrap()); #[derive(Debug)] pub struct DatabasePeer { diff --git a/shared/Cargo.toml b/shared/Cargo.toml index 3ecad0da..e84e3d2c 100644 --- a/shared/Cargo.toml +++ b/shared/Cargo.toml @@ -14,9 +14,9 @@ colored = "2.0" dialoguer = { version = "0.10", default-features = false } indoc = "1" ipnet = { version = "2.4", features = ["serde"] } -lazy_static = "1" libc = "0.2" log = "0.4" +once_cell = "1.17.1" publicip = { path = "../publicip" } regex = "1" serde = { version = "1", features = ["derive"] } diff --git a/shared/src/prompts.rs b/shared/src/prompts.rs index 1b685ef9..2a999f21 100644 --- a/shared/src/prompts.rs +++ b/shared/src/prompts.rs @@ -8,7 +8,7 @@ use anyhow::anyhow; use colored::*; use dialoguer::{theme::ColorfulTheme, Confirm, Input, Select}; use ipnet::IpNet; -use lazy_static::lazy_static; +use once_cell::sync::Lazy; use publicip::Preference; use std::{ fmt::{Debug, Display}, @@ -20,9 +20,7 @@ use std::{ }; use wireguard_control::{InterfaceName, KeyPair}; -lazy_static! { - pub static ref THEME: ColorfulTheme = ColorfulTheme::default(); -} +pub static THEME: Lazy = Lazy::new(ColorfulTheme::default); pub fn ensure_interactive(prompt: &str) -> Result<(), io::Error> { if atty::is(atty::Stream::Stdin) { diff --git a/shared/src/types.rs b/shared/src/types.rs index 446de3ff..7a33bc43 100644 --- a/shared/src/types.rs +++ b/shared/src/types.rs @@ -1,7 +1,7 @@ use anyhow::{anyhow, Error}; use clap::Args; use ipnet::IpNet; -use lazy_static::lazy_static; +use once_cell::sync::Lazy; use regex::Regex; use serde::{Deserialize, Serialize}; use std::{ @@ -758,11 +758,9 @@ impl From for Duration { #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct Hostname(String); -lazy_static! { - /// Regex to match the requirements of hostname(7), needed to have peers also be reachable hostnames. - /// Note that the full length also must be maximum 63 characters, which this regex does not check. - static ref HOSTNAME_REGEX: Regex = Regex::new(r"^([a-z0-9]-?)*[a-z0-9]$").unwrap(); -} +/// Regex to match the requirements of hostname(7), needed to have peers also be reachable hostnames. +/// Note that the full length also must be maximum 63 characters, which this regex does not check. +static HOSTNAME_REGEX: Lazy = Lazy::new(|| Regex::new(r"^([a-z0-9]-?)*[a-z0-9]$").unwrap()); impl Hostname { pub fn is_valid(name: &str) -> bool { From bd4aabe787f89557fa951f05f318602dd62c633c Mon Sep 17 00:00:00 2001 From: Brian Schwind Date: Wed, 31 May 2023 11:48:52 +0900 Subject: [PATCH 07/16] Reset peer's endpoint when NAT traversal fails to connect to any endpoint candidates (#262) * Add a missing call to reset a peer's endpoint when NAT traversal fails to connect to any endpoint candidates * Simplify the process of resetting a peer to its server-reported endpoint --- client/src/nat.rs | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/client/src/nat.rs b/client/src/nat.rs index 41b7b2d7..a3ecf03f 100644 --- a/client/src/nat.rs +++ b/client/src/nat.rs @@ -33,17 +33,28 @@ impl<'a> NatTraverse<'a> { // Limit reported alternative candidates to 10. peer.candidates.truncate(10); - // remove server-reported endpoint from elsewhere in the list if it existed. + // Remove server-reported endpoint from elsewhere in the list if it existed. let endpoint = peer.endpoint.clone(); peer.candidates .retain(|addr| Some(addr) != endpoint.as_ref()); + + // Add the server-reported endpoint to the beginning of the list. In the event + // no other endpoints worked, the remaining endpoint in the list will be the one + // assigned to the peer so it should default to the server-reported endpoint. + // This is inserted at the beginning of the Vec as candidates are popped from + // the end as the algorithm progresses. + if let Some(endpoint) = endpoint { + peer.candidates.insert(0, endpoint); + } } let mut nat_traverse = Self { interface, backend, remaining, }; + nat_traverse.refresh_remaining()?; + Ok(nat_traverse) } @@ -55,10 +66,9 @@ impl<'a> NatTraverse<'a> { self.remaining.len() } - /// Refreshes the current state of candidate traversal attempts, returning - /// the peers that have been exhausted of all options (not included are - /// peers that have successfully connected, or peers removed from the interface). - fn refresh_remaining(&mut self) -> Result, Error> { + /// Refreshes the current state of candidate traversal attempts, filtering out + /// the peers that have been exhausted of all endpoint options. + fn refresh_remaining(&mut self) -> Result<(), Error> { let device = Device::get(self.interface, self.backend)?; // Remove connected and missing peers self.remaining.retain(|peer| { @@ -79,21 +89,14 @@ impl<'a> NatTraverse<'a> { false } }); - let (exhausted, remaining): (Vec<_>, Vec<_>) = self - .remaining - .drain(..) - .partition(|peer| peer.candidates.is_empty()); - self.remaining = remaining; - Ok(exhausted) + + self.remaining.retain(|peer| !peer.candidates.is_empty()); + + Ok(()) } pub fn step(&mut self) -> Result<(), Error> { - let exhausted = self.refresh_remaining()?; - - // Reset peer endpoints that had no viable candidates back to the server-reported one, if it exists. - let reset_updates = exhausted - .into_iter() - .filter_map(|peer| set_endpoint(&peer.public_key, peer.endpoint.as_ref())); + self.refresh_remaining()?; // Set all peers' endpoints to their next available candidate. let candidate_updates = self.remaining.iter_mut().filter_map(|peer| { @@ -104,7 +107,7 @@ impl<'a> NatTraverse<'a> { set_endpoint(&peer.public_key, endpoint.as_ref()) }); - let updates: Vec<_> = reset_updates.chain(candidate_updates).collect(); + let updates: Vec<_> = candidate_updates.collect(); DeviceUpdate::new() .add_peers(&updates) @@ -113,12 +116,14 @@ impl<'a> NatTraverse<'a> { let start = Instant::now(); while start.elapsed() < STEP_INTERVAL { self.refresh_remaining()?; + if self.is_finished() { log::debug!("NAT traverser is finished!"); break; } std::thread::sleep(Duration::from_millis(100)); } + Ok(()) } } From 0057a703ff4962b3d78d6c3f248b67258f79581c Mon Sep 17 00:00:00 2001 From: Brian Schwind Date: Thu, 1 Jun 2023 12:11:31 +0900 Subject: [PATCH 08/16] Turn ChangeString into a PeerChange enum (#263) * Turn ChangeString into a PeerChange enum, don't print NAT traversal reattempt as a modification * Remove the ChangeString type * Fix a stupid copy-paste error --- client/src/util.rs | 48 ++++++++++++++++--- shared/src/types.rs | 109 +++++++++++++++++++++++++------------------- 2 files changed, 102 insertions(+), 55 deletions(-) diff --git a/client/src/util.rs b/client/src/util.rs index 72112b13..cfc2ec8d 100644 --- a/client/src/util.rs +++ b/client/src/util.rs @@ -3,7 +3,9 @@ use colored::*; use indoc::eprintdoc; use log::{Level, LevelFilter}; use serde::{de::DeserializeOwned, Serialize}; -use shared::{interface_config::ServerInfo, Interface, PeerDiff, INNERNET_PUBKEY_HEADER}; +use shared::{ + interface_config::ServerInfo, Interface, PeerChange, PeerDiff, INNERNET_PUBKEY_HEADER, +}; use std::{ffi::OsStr, io, path::Path, time::Duration}; use ureq::{Agent, AgentBuilder}; @@ -137,13 +139,30 @@ pub fn permissions_helptext(config_dir: &Path, data_dir: &Path, e: &io::Error) { } } +#[derive(Debug, Copy, Clone, PartialEq)] +enum ChangeAction { + Added, + Modified, + Removed, +} + +impl ChangeAction { + fn colored_output(&self) -> ColoredString { + match self { + Self::Added => "added".green(), + Self::Modified => "modified".yellow(), + Self::Removed => "removed".red(), + } + } +} + pub fn print_peer_diff(store: &DataStore, diff: &PeerDiff) { let public_key = diff.public_key().to_base64(); - let text = match (diff.old, diff.new) { - (None, Some(_)) => "added".green(), - (Some(_), Some(_)) => "modified".yellow(), - (Some(_), None) => "removed".red(), + let change_action = match (diff.old, diff.new) { + (None, Some(_)) => ChangeAction::Added, + (Some(_), Some(_)) => ChangeAction::Modified, + (Some(_), None) => ChangeAction::Removed, _ => unreachable!("PeerDiff can't be None -> None"), }; @@ -158,15 +177,30 @@ pub fn print_peer_diff(store: &DataStore, diff: &PeerDiff) { }; let peer_name = peer_hostname.as_deref().unwrap_or("[unknown]"); + if change_action == ChangeAction::Modified + && diff + .changes() + .iter() + .all(|c| *c == PeerChange::NatTraverseReattempt) + { + // If this peer was "modified" but the only change is a NAT Traversal Reattempt, + // don't bother printing this peer. + return; + } + log::info!( " peer {} ({}...) was {}.", peer_name.yellow(), &public_key[..10].dimmed(), - text + change_action.colored_output(), ); for change in diff.changes() { - log::debug!(" {}", change); + if let PeerChange::Endpoint { .. } = change { + log::info!(" {}", change); + } else { + log::debug!(" {}", change); + } } } diff --git a/shared/src/types.rs b/shared/src/types.rs index 7a33bc43..b1e398d6 100644 --- a/shared/src/types.rs +++ b/shared/src/types.rs @@ -519,35 +519,55 @@ impl Display for Peer { } } -#[derive(Clone, Debug, PartialEq, Eq)] -pub struct ChangeString { - name: &'static str, - old: Option, - new: Option, -} - -impl Display for ChangeString { +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum PeerChange { + AllowedIPs { + old: Vec, + new: Vec, + }, + PersistentKeepalive { + old: Option, + new: Option, + }, + Endpoint { + old: Option, + new: Option, + }, + NatTraverseReattempt, +} + +impl Display for PeerChange { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { - write!( - f, - "{}: {} => {}", - self.name, - self.old.as_deref().unwrap_or("[none]"), - self.new.as_deref().unwrap_or("[none]") - ) + match self { + Self::AllowedIPs { old, new } => write!(f, "Allowed IPs: {:?} => {:?}", old, new), + Self::PersistentKeepalive { old, new } => write!( + f, + "Persistent Keepalive: {} => {}", + old.display_string(), + new.display_string() + ), + Self::Endpoint { old, new } => write!( + f, + "Endpoint: {} => {}", + old.display_string(), + new.display_string() + ), + Self::NatTraverseReattempt => write!(f, "NAT Traversal Reattempt"), + } } } -impl ChangeString { - pub fn new(name: &'static str, old: Option, new: Option) -> Self - where - T: fmt::Debug, - U: fmt::Debug, - { - Self { - name, - old: old.map(|t| format!("{t:?}")), - new: new.map(|t| format!("{t:?}")), +trait OptionExt { + fn display_string(&self) -> String; +} + +impl OptionExt for Option { + fn display_string(&self) -> String { + match self { + Some(x) => { + format!("{:?}", x) + }, + None => "[none]".to_string(), } } } @@ -559,7 +579,7 @@ pub struct PeerDiff<'a> { pub old: Option<&'a PeerConfig>, pub new: Option<&'a Peer>, builder: PeerConfigBuilder, - changes: Vec, + changes: Vec, } impl<'a> PeerDiff<'a> { @@ -588,14 +608,14 @@ impl<'a> PeerDiff<'a> { self.builder.public_key() } - pub fn changes(&self) -> &[ChangeString] { + pub fn changes(&self) -> &[PeerChange] { &self.changes } fn peer_config_builder( old_info: Option<&PeerInfo>, new: Option<&Peer>, - ) -> Option<(PeerConfigBuilder, Vec)> { + ) -> Option<(PeerConfigBuilder, Vec)> { let old = old_info.map(|p| &p.config); let public_key = match (old, new) { (Some(old), _) => old.public_key.clone(), @@ -622,11 +642,10 @@ impl<'a> PeerDiff<'a> { builder = builder .replace_allowed_ips() .add_allowed_ips(new_allowed_ips); - changes.push(ChangeString::new( - "AllowedIPs", - old.map(|o| &o.allowed_ips[..]), - Some(&new_allowed_ips[0]), - )); + changes.push(PeerChange::AllowedIPs { + old: old.map(|o| o.allowed_ips.clone()).unwrap_or_else(Vec::new), + new: new_allowed_ips.to_vec(), + }); } if old.is_none() @@ -636,11 +655,10 @@ impl<'a> PeerDiff<'a> { Some(interval) => builder.set_persistent_keepalive_interval(interval), None => builder.unset_persistent_keepalive(), }; - changes.push(ChangeString::new( - "PersistentKeepalive", - old.and_then(|p| p.persistent_keepalive_interval), - new.persistent_keepalive_interval, - )); + changes.push(PeerChange::PersistentKeepalive { + old: old.and_then(|p| p.persistent_keepalive_interval), + new: new.persistent_keepalive_interval, + }); } // We won't update the endpoint if there's already a stable connection. @@ -653,20 +671,15 @@ impl<'a> PeerDiff<'a> { if let Some(addr) = resolved { if old.is_none() || matches!(old, Some(old) if old.endpoint != resolved) { builder = builder.set_endpoint(addr); - changes.push(ChangeString::new( - "Endpoint", - old.and_then(|p| p.endpoint), - Some(addr), - )); + changes.push(PeerChange::Endpoint { + old: old.and_then(|p| p.endpoint), + new: Some(addr), + }); endpoint_changed = true; } } if !endpoint_changed && !new.candidates.is_empty() { - changes.push(ChangeString::new( - "Connection status", - "Disconnected".into(), - "NAT traverse reattempt".into(), - )); + changes.push(PeerChange::NatTraverseReattempt) } } From 33cee129d1693e92a2ae587cbd767d89972ab7ef Mon Sep 17 00:00:00 2001 From: Jake McGinty Date: Thu, 1 Jun 2023 01:25:46 -0500 Subject: [PATCH 09/16] Various dependency updates (#265) * update netlink-*, toml, clap, other small dependencies * switch back to x25519-dalek from curve25519-dalek --- Cargo.lock | 768 ++++++++++++++++------- client/Cargo.toml | 6 +- client/src/main.rs | 14 +- client/src/util.rs | 2 +- netlink-request/Cargo.toml | 9 +- netlink-request/src/lib.rs | 7 +- server/Cargo.toml | 18 +- server/src/initialize.rs | 2 +- server/src/main.rs | 12 +- shared/Cargo.toml | 14 +- shared/src/interface_config.rs | 4 +- shared/src/netlink.rs | 60 +- shared/src/types.rs | 17 +- wireguard-control/Cargo.toml | 13 +- wireguard-control/src/backends/kernel.rs | 4 +- wireguard-control/src/key.rs | 12 +- 16 files changed, 637 insertions(+), 325 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 425713a4..11c01402 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,29 +4,78 @@ version = 3 [[package]] name = "ahash" -version = "0.7.6" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "getrandom", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "aho-corasick" -version = "0.7.20" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04" dependencies = [ "memchr", ] +[[package]] +name = "anstream" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is-terminal", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d" + +[[package]] +name = "anstyle-parse" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +dependencies = [ + "windows-sys 0.48.0", +] + +[[package]] +name = "anstyle-wincon" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" +dependencies = [ + "anstyle", + "windows-sys 0.48.0", +] + [[package]] name = "anyhow" -version = "1.0.68" +version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61" +checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" [[package]] name = "atty" @@ -57,6 +106,12 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6776fc96284a0bb647b615056fc496d1fe1644a7ab01829818a6d91cae888b84" + [[package]] name = "byteorder" version = "1.4.3" @@ -65,15 +120,15 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" +checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" [[package]] name = "cc" -version = "1.0.78" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" [[package]] name = "cfg-if" @@ -83,38 +138,45 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "3.2.23" +version = "4.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5" +checksum = "93aae7a4192245f70fe75dd9157fc7b4a5bf53e88d30bd4396f7d8f9284d5acc" dependencies = [ - "atty", - "bitflags", + "clap_builder", "clap_derive", - "clap_lex", - "indexmap", "once_cell", +] + +[[package]] +name = "clap_builder" +version = "4.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f423e341edefb78c9caba2d9c7f7687d0e72e89df3ce3394554754393ac3990" +dependencies = [ + "anstream", + "anstyle", + "bitflags 1.3.2", + "clap_lex", "strsim", - "termcolor", - "textwrap", + "terminal_size", ] [[package]] name = "clap_complete" -version = "3.2.5" +version = "4.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f7a2e0a962c45ce25afce14220bc24f9dade0a1787f185cecf96bfba7847cd8" +checksum = "a04ddfaacc3bc9e6ea67d024575fafc2a813027cf374b8f24f7bc233c6b6be12" dependencies = [ "clap", ] [[package]] name = "clap_derive" -version = "3.2.18" +version = "4.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea0c8bce528c4be4da13ea6fead8965e95b6073585a2f05204bd8f4119f82a65" +checksum = "191d9573962933b4027f932c600cd252ce27a8ad5979418fe78e43c07996f27b" dependencies = [ "heck", - "proc-macro-error", "proc-macro2", "quote", "syn", @@ -122,12 +184,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.2.4" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" -dependencies = [ - "os_str_bytes", -] +checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" [[package]] name = "client" @@ -152,6 +211,12 @@ dependencies = [ "wireguard-control", ] +[[package]] +name = "colorchoice" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" + [[package]] name = "colored" version = "2.0.0" @@ -165,22 +230,22 @@ dependencies = [ [[package]] name = "console" -version = "0.15.4" +version = "0.15.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9b6515d269224923b26b5febea2ed42b2d5f2ce37284a4dd670fedd6cb8347a" +checksum = "c926e00cc70edefdc64d3a5ff31cc65bb97a3460097762bd23afb4d8145fccf8" dependencies = [ "encode_unicode", "lazy_static", "libc", "unicode-width", - "windows-sys", + "windows-sys 0.45.0", ] [[package]] name = "curve25519-dalek" -version = "4.0.0-pre.5" +version = "4.0.0-rc.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67bc65846be335cb20f4e52d49a437b773a2c1fdb42b19fc84e79e6f6771536f" +checksum = "03d928d978dbec61a1167414f5ec534f24bea0d7a0d24dd9b6233d3d8223e585" dependencies = [ "cfg-if", "fiat-crypto", @@ -192,11 +257,12 @@ dependencies = [ [[package]] name = "dialoguer" -version = "0.10.2" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92e7e37ecef6857fdc0c0c5d42fd5b0938e46590c2183cc92dd310a6d078eb1" +checksum = "59c6f2989294b9a498d3ad5491a79c6deb604617378e1cdc4bfc1c1361fe2f87" dependencies = [ "console", + "shell-words", ] [[package]] @@ -218,6 +284,27 @@ dependencies = [ "termcolor", ] +[[package]] +name = "errno" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" +dependencies = [ + "errno-dragonfly", + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "fallible-iterator" version = "0.2.0" @@ -232,18 +319,18 @@ checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" [[package]] name = "fastrand" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" dependencies = [ "instant", ] [[package]] name = "fiat-crypto" -version = "0.1.17" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a214f5bb88731d436478f3ae1f8a277b62124089ba9fb67f4f93fb100ef73c90" +checksum = "e825f6987101665dea6ec934c09ec6d721de7bc1bf92248e1d5810c8cd636b77" [[package]] name = "fnv" @@ -262,30 +349,30 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.25" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" +checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" dependencies = [ "futures-core", ] [[package]] name = "futures-core" -version = "0.3.25" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" +checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" [[package]] name = "futures-task" -version = "0.3.25" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" +checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" [[package]] name = "futures-util" -version = "0.3.25" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" +checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" dependencies = [ "futures-core", "futures-task", @@ -295,9 +382,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" +checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" dependencies = [ "cfg-if", "libc", @@ -309,24 +396,30 @@ name = "hashbrown" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" dependencies = [ "ahash", ] [[package]] name = "hashlink" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69fe1fcf8b4278d860ad0548329f892a3631fb63f82574df68275f34cdbe0ffa" +checksum = "0761a1b9491c4f2e3d66aa0f62d0fba0af9a0e2852e4d48ea506632a4b56e6aa" dependencies = [ - "hashbrown", + "hashbrown 0.13.2", ] [[package]] name = "heck" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" @@ -346,6 +439,12 @@ dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" + [[package]] name = "hex" version = "0.4.3" @@ -362,9 +461,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" dependencies = [ "bytes", "fnv", @@ -405,9 +504,9 @@ dependencies = [ [[package]] name = "hyper" -version = "0.14.23" +version = "0.14.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "034711faac9d2166cb1baf1a2fb0b60b1f277f8492fd72176c17f3515e1abd3c" +checksum = "ab302d72a6f11a3b910431ff93aae7e773078c769f0a3ef15fb9ec692ed147d4" dependencies = [ "bytes", "futures-channel", @@ -419,7 +518,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2", + "socket2 0.4.9", "tokio", "tower-service", "tracing", @@ -438,19 +537,19 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.9.2" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", ] [[package]] name = "indoc" -version = "1.0.8" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da2d6f23ffea9d7e76c53eee25dfb67bcd8fde7f1198b0855350698c9f07c780" +checksum = "9f2cb48b81b1dc9f39676bf99f5499babfec7cd8fe14307f7b3d747208fb5690" [[package]] name = "instant" @@ -461,20 +560,43 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "io-lifetimes" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" +dependencies = [ + "hermit-abi 0.3.1", + "libc", + "windows-sys 0.48.0", +] + [[package]] name = "ipnet" -version = "2.7.1" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146" +checksum = "12b6ee2129af8d4fb011108c73d99a1b83a85977f23b82460c0ae2e25bb4b57f" dependencies = [ "serde", ] +[[package]] +name = "is-terminal" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" +dependencies = [ + "hermit-abi 0.3.1", + "io-lifetimes", + "rustix", + "windows-sys 0.48.0", +] + [[package]] name = "itoa" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" +checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" [[package]] name = "lazy_static" @@ -484,9 +606,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.139" +version = "0.2.144" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" +checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" [[package]] name = "libm" @@ -496,15 +618,21 @@ checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a" [[package]] name = "libsqlite3-sys" -version = "0.25.2" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29f835d03d717946d28b1d1ed632eb6f0e24a299388ee623d0c23118d3e8a7fa" +checksum = "afc22eff61b133b115c6e8c74e818c628d6d5e7a502afea6f64dee076dd94326" dependencies = [ "cc", "pkg-config", "vcpkg", ] +[[package]] +name = "linux-raw-sys" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" + [[package]] name = "lock_api" version = "0.4.9" @@ -517,12 +645,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.17" +version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] +checksum = "518ef76f2f87365916b142844c16d8fefd85039bc5699050210a7778ee1cd1de" [[package]] name = "memchr" @@ -539,23 +664,31 @@ dependencies = [ "autocfg", ] +[[package]] +name = "memoffset" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" +dependencies = [ + "autocfg", +] + [[package]] name = "mio" -version = "0.8.5" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" dependencies = [ "libc", - "log", "wasi", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] name = "netlink-packet-core" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "345b8ab5bd4e71a2986663e88c56856699d060e78e152e6e9d7966fcd5491297" +checksum = "7e5cf0b54effda4b91615c40ff0fd12d0d4c9a6e0f5116874f03941792ff535a" dependencies = [ "anyhow", "byteorder", @@ -565,9 +698,9 @@ dependencies = [ [[package]] name = "netlink-packet-generic" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94a5d5ed7a2e8303cde48c4c75b9cbe004d1df98bdd0183aea8f4db7f010cb00" +checksum = "6c2b2fb3594ee2c5f4076579104ee6f2a74cf138e608a5f07ca31ee929a9367f" dependencies = [ "anyhow", "byteorder", @@ -578,12 +711,12 @@ dependencies = [ [[package]] name = "netlink-packet-route" -version = "0.13.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5dee5ed749373c298237fe694eb0a51887f4cc1a27370c8464bac4382348f1a" +checksum = "ea993e32c77d87f01236c38f572ecb6c311d592e56a06262a007fd2a6e31253c" dependencies = [ "anyhow", - "bitflags", + "bitflags 1.3.2", "byteorder", "libc", "netlink-packet-core", @@ -592,9 +725,9 @@ dependencies = [ [[package]] name = "netlink-packet-utils" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25af9cf0dc55498b7bd94a1508af7a78706aa0ab715a73c5169273e03c84845e" +checksum = "0ede8a08c71ad5a95cdd0e4e52facd37190977039a4704eb82a283f713747d34" dependencies = [ "anyhow", "byteorder", @@ -623,16 +756,17 @@ dependencies = [ "netlink-packet-core", "netlink-packet-generic", "netlink-packet-route", + "netlink-packet-utils", "netlink-sys", - "nix", + "nix 0.25.1", "once_cell", ] [[package]] name = "netlink-sys" -version = "0.8.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92b654097027250401127914afb37cb1f311df6610a9891ff07a757e94199027" +checksum = "6471bf08e7ac0135876a9581bf3217ef0333c191c128d34878079f42ee150411" dependencies = [ "bytes", "libc", @@ -646,11 +780,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4" dependencies = [ "autocfg", - "bitflags", + "bitflags 1.3.2", + "cfg-if", + "libc", + "memoffset 0.6.5", + "pin-utils", +] + +[[package]] +name = "nix" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a" +dependencies = [ + "bitflags 1.3.2", "cfg-if", "libc", - "memoffset", + "memoffset 0.7.1", "pin-utils", + "static_assertions", ] [[package]] @@ -669,12 +817,6 @@ version = "1.17.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9670a07f94779e00908f3e686eab508878ebb390ba6e604d3a284c00e8d0487b" -[[package]] -name = "os_str_bytes" -version = "6.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" - [[package]] name = "packed_simd_2" version = "0.3.8" @@ -697,22 +839,22 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.6" +version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba1ef8814b5c993410bb3adfad7a5ed269563e4a2f90c41f5d85be7fb47133bf" +checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.2.16", "smallvec", - "windows-sys", + "windows-sys 0.45.0", ] [[package]] name = "paste" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba" +checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" [[package]] name = "percent-encoding" @@ -734,9 +876,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.26" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" +checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" [[package]] name = "platforms" @@ -754,35 +896,11 @@ dependencies = [ "log", ] -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - [[package]] name = "proc-macro2" -version = "1.0.49" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5" +checksum = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b" dependencies = [ "unicode-ident", ] @@ -799,9 +917,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quote" -version = "1.0.23" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -821,14 +939,23 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ - "bitflags", + "bitflags 1.3.2", +] + +[[package]] +name = "redox_syscall" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +dependencies = [ + "bitflags 1.3.2", ] [[package]] name = "regex" -version = "1.7.1" +version = "1.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" +checksum = "81ca098a9821bd52d6b24fd8b10bd081f47d39c22778cafaa75a2857a62c6390" dependencies = [ "aho-corasick", "memchr", @@ -837,26 +964,17 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.28" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" - -[[package]] -name = "remove_dir_all" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi", -] +checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78" [[package]] name = "rusqlite" -version = "0.28.0" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01e213bc3ecb39ac32e81e51ebe31fd888a940515173e3a18a35f8c6e896422a" +checksum = "549b9d036d571d42e6e85d1c1425e2ac83491075078ca9a15be021c56b1641f2" dependencies = [ - "bitflags", + "bitflags 2.3.1", "fallible-iterator", "fallible-streaming-iterator", "hashlink", @@ -864,11 +982,25 @@ dependencies = [ "smallvec", ] +[[package]] +name = "rustix" +version = "0.37.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d" +dependencies = [ + "bitflags 1.3.2", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys 0.48.0", +] + [[package]] name = "ryu" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" +checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" [[package]] name = "scopeguard" @@ -878,18 +1010,18 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "serde" -version = "1.0.152" +version = "1.0.163" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" +checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.152" +version = "1.0.163" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" +checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e" dependencies = [ "proc-macro2", "quote", @@ -898,15 +1030,24 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.91" +version = "1.0.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883" +checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" dependencies = [ "itoa", "ryu", "serde", ] +[[package]] +name = "serde_spanned" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93107647184f6027e3b7dcb2e11034cf95ffa1e3a682c67951963ac69c1c007d" +dependencies = [ + "serde", +] + [[package]] name = "server" version = "1.5.5" @@ -932,7 +1073,7 @@ dependencies = [ "serde", "serde_json", "shared", - "socket2", + "socket2 0.5.3", "subtle", "tempfile", "thiserror", @@ -959,7 +1100,7 @@ dependencies = [ "netlink-packet-route", "netlink-request", "netlink-sys", - "nix", + "nix 0.26.2", "once_cell", "publicip", "regex", @@ -969,6 +1110,12 @@ dependencies = [ "wireguard-control", ] +[[package]] +name = "shell-words" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" + [[package]] name = "smallvec" version = "1.10.0" @@ -977,14 +1124,30 @@ checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] name = "socket2" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" +checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" dependencies = [ "libc", "winapi", ] +[[package]] +name = "socket2" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877" +dependencies = [ + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + [[package]] name = "strsim" version = "0.10.0" @@ -993,15 +1156,15 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "subtle" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" [[package]] name = "syn" -version = "1.0.107" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" +checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" dependencies = [ "proc-macro2", "quote", @@ -1010,47 +1173,50 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.3.0" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" +checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" dependencies = [ "cfg-if", "fastrand", - "libc", - "redox_syscall", - "remove_dir_all", - "winapi", + "redox_syscall 0.3.5", + "rustix", + "windows-sys 0.45.0", ] [[package]] name = "termcolor" -version = "1.1.3" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" dependencies = [ "winapi-util", ] [[package]] -name = "textwrap" -version = "0.16.0" +name = "terminal_size" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" +checksum = "8e6bf6f19e9f8ed8d4048dc22981458ebcf406d67e94cd422e5ecd73d63b3237" +dependencies = [ + "rustix", + "windows-sys 0.48.0", +] [[package]] name = "thiserror" -version = "1.0.38" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" +checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.38" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" +checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", @@ -1068,31 +1234,31 @@ dependencies = [ [[package]] name = "tinyvec_macros" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.24.1" +version = "1.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d9f76183f91ecfb55e1d7d5602bd1d979e38a3a522fe900241cf195624d67ae" +checksum = "94d7b1cfd2aa4011f2de74c2c4c63665e27a71006b0a192dcd2710272e73dfa2" dependencies = [ "autocfg", "libc", "mio", "num_cpus", "pin-project-lite", - "socket2", + "socket2 0.4.9", "tokio-macros", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] name = "tokio-macros" -version = "1.8.2" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8" +checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", @@ -1101,11 +1267,36 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.10" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6135d499e69981f9ff0ef2167955a5333c35e36f6937d382974566b3d5b94ec" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a76a9312f5ba4c2dec6b9161fdf25d87ad8a09256ccea5a556fef03c706a10f" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.19.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1333c76748e868a4d9d1017b5ab53171dfd095f70c712fdb4653a406547f598f" +checksum = "2380d56e8670370eee6566b0bfd4265f65b3f432e8c6d85623f728d4fa31f739" dependencies = [ + "indexmap", "serde", + "serde_spanned", + "toml_datetime", + "winnow", ] [[package]] @@ -1127,9 +1318,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.30" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" +checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" dependencies = [ "once_cell", ] @@ -1142,15 +1333,15 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "unicode-bidi" -version = "0.3.8" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.6" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "unicode-normalization" @@ -1169,9 +1360,9 @@ checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" [[package]] name = "ureq" -version = "2.6.1" +version = "2.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "733b5ad78377302af52c0dbcb2623d78fe50e4b3bf215948ff29e9ee031d8566" +checksum = "338b31dd1314f68f3aabf3ed57ab922df95ffcd902476ca7ba3c4ce7b908c46d" dependencies = [ "base64", "log", @@ -1192,6 +1383,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + [[package]] name = "vcpkg" version = "0.2.15" @@ -1253,81 +1450,192 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-sys" -version = "0.42.0" +version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows-targets 0.42.2", ] +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.0", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-targets" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +dependencies = [ + "windows_aarch64_gnullvm 0.48.0", + "windows_aarch64_msvc 0.48.0", + "windows_i686_gnu 0.48.0", + "windows_i686_msvc 0.48.0", + "windows_x86_64_gnu 0.48.0", + "windows_x86_64_gnullvm 0.48.0", + "windows_x86_64_msvc 0.48.0", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.0" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" +checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" [[package]] name = "windows_aarch64_msvc" -version = "0.42.0" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" [[package]] name = "windows_i686_gnu" -version = "0.42.0" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" [[package]] name = "windows_i686_msvc" -version = "0.42.0" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" [[package]] name = "windows_x86_64_gnu" -version = "0.42.0" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" +checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.0" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" [[package]] name = "windows_x86_64_msvc" -version = "0.42.0" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" + +[[package]] +name = "winnow" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" +checksum = "61de7bac303dc551fe038e2b3cef0f571087a47571ea6e79a87692ac99b99699" +dependencies = [ + "memchr", +] [[package]] name = "wireguard-control" version = "1.5.5" dependencies = [ "base64", - "curve25519-dalek", "hex", "libc", "log", "netlink-packet-core", "netlink-packet-generic", "netlink-packet-route", + "netlink-packet-utils", "netlink-packet-wireguard", "netlink-request", "netlink-sys", "rand_core", + "x25519-dalek", +] + +[[package]] +name = "x25519-dalek" +version = "2.0.0-rc.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fabd6e16dd08033932fc3265ad4510cc2eab24656058a6dcb107ffe274abcc95" +dependencies = [ + "curve25519-dalek", + "rand_core", + "serde", + "zeroize", ] [[package]] name = "zeroize" -version = "1.5.7" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/client/Cargo.toml b/client/Cargo.toml index 1c16c40b..d8ec5b09 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -16,11 +16,11 @@ path = "src/main.rs" [dependencies] anyhow = "1" colored = "2" -clap = { version = "3", features = ["derive"] } -clap_complete = "3" +clap = { version = "4.3", features = ["derive", "wrap_help"] } +clap_complete = "4.3" dialoguer = { version = "0.10", default-features = false } hostsfile = { path = "../hostsfile" } -indoc = "1" +indoc = "2.0.1" ipnet = { version = "2.4", features = ["serde"] } log = "0.4" regex = { version = "1", default-features = false, features = ["std"] } diff --git a/client/src/main.rs b/client/src/main.rs index f9acca40..86095ee7 100644 --- a/client/src/main.rs +++ b/client/src/main.rs @@ -1,5 +1,5 @@ use anyhow::{anyhow, bail}; -use clap::{AppSettings, Args, IntoApp, Parser, Subcommand}; +use clap::{ArgAction, Args, Parser, Subcommand}; use colored::*; use dialoguer::{Confirm, Input}; use hostsfile::HostsBuilder; @@ -47,15 +47,14 @@ macro_rules! println_pad { } #[derive(Clone, Debug, Parser)] -#[clap(name = "innernet", author, version, about)] -#[clap(global_setting(AppSettings::DeriveDisplayOrder))] +#[command(name = "innernet", author, version, about)] struct Opts { #[clap(subcommand)] command: Option, /// Verbose output, use -vv for even higher verbositude - #[clap(short, long, parse(from_occurrences))] - verbose: u64, + #[clap(short, long, action = ArgAction::Count)] + verbose: u8, #[clap(short, long, default_value = "/etc/innernet")] config_dir: PathBuf, @@ -74,7 +73,7 @@ struct HostsOpt { hosts_path: PathBuf, /// Don't write to any hosts files - #[clap(long = "no-write-hosts", conflicts_with = "hosts-path")] + #[clap(long = "no-write-hosts", conflicts_with = "hosts_path")] no_write_hosts: bool, } @@ -254,7 +253,7 @@ enum Command { /// Generate shell completion scripts Completions { - #[clap(arg_enum)] + #[clap(value_enum)] shell: clap_complete::Shell, }, } @@ -1275,6 +1274,7 @@ fn run(opts: &Opts) -> Result<(), Error> { override_endpoint(&interface, opts, sub_opts)?; }, Command::Completions { shell } => { + use clap::CommandFactory; let mut app = Opts::command(); let app_name = app.get_name().to_string(); clap_complete::generate(shell, &mut app, app_name, &mut std::io::stdout()); diff --git a/client/src/util.rs b/client/src/util.rs index cfc2ec8d..3e42e7ab 100644 --- a/client/src/util.rs +++ b/client/src/util.rs @@ -51,7 +51,7 @@ impl log::Log for Logger { fn flush(&self) {} } -pub fn init_logger(verbosity: u64) { +pub fn init_logger(verbosity: u8) { let level = match verbosity { 0 => log::LevelFilter::Info, 1 => log::LevelFilter::Debug, diff --git a/netlink-request/Cargo.toml b/netlink-request/Cargo.toml index 71ee7032..728a3d9b 100644 --- a/netlink-request/Cargo.toml +++ b/netlink-request/Cargo.toml @@ -4,9 +4,10 @@ version = "1.5.5" edition = "2021" [target.'cfg(target_os = "linux")'.dependencies] -netlink-sys = "0.8" -netlink-packet-core = "0.4" -netlink-packet-generic = "0.3" -netlink-packet-route = "0.13" +netlink-sys = "0.8.5" +netlink-packet-core = "0.5" +netlink-packet-generic = "0.3.2" +netlink-packet-route = "0.15" +netlink-packet-utils = "0.5.2" nix = { version = "0.25", features = ["feature"] } once_cell = "1" diff --git a/netlink-request/src/lib.rs b/netlink-request/src/lib.rs index 686498eb..90f4c3e3 100644 --- a/netlink-request/src/lib.rs +++ b/netlink-request/src/lib.rs @@ -7,9 +7,10 @@ mod linux { use netlink_packet_generic::{ constants::GENL_HDRLEN, ctrl::{nlas::GenlCtrlAttrs, GenlCtrl, GenlCtrlCmd}, - GenlFamily, GenlMessage, + GenlFamily, GenlHeader, GenlMessage, }; use netlink_packet_route::RtnlMessage; + use netlink_packet_utils::{Emitable, ParseableParametrized}; use netlink_sys::{constants::NETLINK_GENERIC, protocols::NETLINK_ROUTE, Socket}; use nix::unistd::{sysconf, SysconfVar}; use once_cell::sync::OnceCell; @@ -49,7 +50,7 @@ mod linux { flags: Option, ) -> Result>>, io::Error> where - F: GenlFamily + Clone + Debug + Eq, + F: GenlFamily + Clone + Debug + Eq + Emitable + ParseableParametrized<[u8], GenlHeader>, GenlMessage: Clone + Debug + Eq + NetlinkSerializable + NetlinkDeserializable, { if message.family_id() == 0 { @@ -98,7 +99,7 @@ mod linux { ) -> Result>, io::Error> where NetlinkPayload: From, - I: Clone + Debug + Eq + NetlinkSerializable + NetlinkDeserializable, + I: Clone + Debug + Eq + Emitable + NetlinkSerializable + NetlinkDeserializable, { let mut req = NetlinkMessage::from(message); diff --git a/server/Cargo.toml b/server/Cargo.toml index d7676dd5..c2afeecc 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -18,38 +18,38 @@ v6-test = [] [dependencies] anyhow = "1" bytes = "1" -clap = { version = "3", features = ["derive"] } -clap_complete = "3" +clap = { version = "4.3", features = ["derive", "wrap_help"] } +clap_complete = "4.3" colored = "2" dialoguer = { version = "0.10", default-features = false } hyper = { version = "0.14", default-features = false, features = ["http1", "server", "runtime", "stream"] } -indoc = "1" +indoc = "2.0.1" ipnet = { version = "2.4", features = ["serde"] } libc = "0.2" -libsqlite3-sys = "0.25" +libsqlite3-sys = "0.26" log = "0.4" once_cell = "1.17.1" parking_lot = "0.12" pretty_env_logger = "0.4" publicip = { path = "../publicip" } regex = { version = "1", default-features = false, features = ["std"] } -rusqlite = "0.28" +rusqlite = "0.29" serde = { version = "1", features = ["derive"] } serde_json = "1" shared = { path = "../shared" } subtle = "2" thiserror = "1" -tokio = { version = "1", features = ["macros", "rt-multi-thread", "time"] } -toml = "0.5" +tokio = { version = "1.28.0", features = ["macros", "rt-multi-thread", "time"] } +toml = "0.7.4" url = "2" wireguard-control = { path = "../wireguard-control" } [target.'cfg(target_os = "linux")'.dependencies] -socket2 = { version = "0.4", features = ["all"] } +socket2 = { version = "0.5.2", features = ["all"] } # Workaround for https://github.com/rusqlite/rusqlite/issues/914 [target.'cfg(target_env = "musl")'.dependencies] -rusqlite = { version = "0.28", features = ["bundled"] } +rusqlite = { version = "0.29", features = ["bundled"] } [dev-dependencies] anyhow = "1" diff --git a/server/src/initialize.rs b/server/src/initialize.rs index 2c81773f..f51b1400 100644 --- a/server/src/initialize.rs +++ b/server/src/initialize.rs @@ -37,7 +37,7 @@ pub struct InitializeOpts { pub network_cidr: Option, /// This server's external endpoint (ex: 100.100.100.100:51820) - #[clap(long, conflicts_with = "auto-external-endpoint")] + #[clap(long, conflicts_with = "auto_external_endpoint")] pub external_endpoint: Option, /// Auto-resolve external endpoint diff --git a/server/src/main.rs b/server/src/main.rs index 3f6eea66..6745e4c4 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -1,5 +1,5 @@ use anyhow::{anyhow, bail}; -use clap::{AppSettings, IntoApp, Parser, Subcommand}; +use clap::{Parser, Subcommand}; use colored::*; use dialoguer::Confirm; use hyper::{http, server::conn::AddrStream, Body, Request, Response}; @@ -45,8 +45,7 @@ pub use shared::{Association, AssociationContents}; pub const VERSION: &str = env!("CARGO_PKG_VERSION"); #[derive(Debug, Parser)] -#[clap(name = "innernet-server", author, version, about)] -#[clap(global_setting(AppSettings::DeriveDisplayOrder))] +#[command(name = "innernet-server", author, version, about)] struct Opts { #[clap(subcommand)] command: Command, @@ -127,7 +126,7 @@ enum Command { /// Generate shell completion scripts Completions { - #[clap(arg_enum)] + #[clap(value_enum)] shell: clap_complete::Shell, }, } @@ -199,7 +198,9 @@ impl ConfigFile { path.display() ); } - Ok(toml::from_slice(&std::fs::read(path).with_path(path)?)?) + Ok(toml::from_str( + &std::fs::read_to_string(path).with_path(path)?, + )?) } } @@ -279,6 +280,7 @@ async fn main() -> Result<(), Box> { Command::AddCidr { interface, args } => add_cidr(&interface, &conf, args)?, Command::DeleteCidr { interface, args } => delete_cidr(&interface, &conf, args)?, Command::Completions { shell } => { + use clap::CommandFactory; let mut app = Opts::command(); let app_name = app.get_name().to_string(); clap_complete::generate(shell, &mut app, app_name, &mut std::io::stdout()); diff --git a/shared/Cargo.toml b/shared/Cargo.toml index e84e3d2c..80d344dc 100644 --- a/shared/Cargo.toml +++ b/shared/Cargo.toml @@ -9,10 +9,10 @@ version = "1.5.5" [dependencies] anyhow = "1" atty = "0.2" -clap = { version = "3", features = ["derive"] } +clap = { version = "4.3", features = ["derive", "wrap_help"] } colored = "2.0" dialoguer = { version = "0.10", default-features = false } -indoc = "1" +indoc = "2.0.1" ipnet = { version = "2.4", features = ["serde"] } libc = "0.2" log = "0.4" @@ -20,15 +20,15 @@ once_cell = "1.17.1" publicip = { path = "../publicip" } regex = "1" serde = { version = "1", features = ["derive"] } -toml = "0.5" +toml = "0.7.4" url = "2" wireguard-control = { path = "../wireguard-control" } [target.'cfg(target_os = "linux")'.dependencies] -netlink-sys = "0.8" -netlink-packet-core = "0.4" -netlink-packet-route = "0.13" +netlink-sys = "0.8.5" +netlink-packet-core = "0.5" +netlink-packet-route = "0.15" netlink-request = { path = "../netlink-request" } [target.'cfg(target_os = "macos")'.dependencies] -nix = "0.25" +nix = "0.26" diff --git a/shared/src/interface_config.rs b/shared/src/interface_config.rs index c3596109..4f81d41a 100644 --- a/shared/src/interface_config.rs +++ b/shared/src/interface_config.rs @@ -112,7 +112,9 @@ impl InterfaceConfig { } pub fn from_file>(path: P) -> Result { - Ok(toml::from_slice(&std::fs::read(&path).with_path(path)?)?) + Ok(toml::from_str( + &std::fs::read_to_string(&path).with_path(path)?, + )?) } pub fn from_interface(config_dir: &Path, interface: &InterfaceName) -> Result { diff --git a/shared/src/netlink.rs b/shared/src/netlink.rs index 3a71c32f..4bb86ff0 100644 --- a/shared/src/netlink.rs +++ b/shared/src/netlink.rs @@ -1,5 +1,8 @@ use ipnet::IpNet; -use netlink_packet_core::{NetlinkMessage, NetlinkPayload, NLM_F_ACK, NLM_F_CREATE, NLM_F_REQUEST}; +use netlink_packet_core::{ + NetlinkMessage, NetlinkPayload, NLM_F_ACK, NLM_F_CREATE, NLM_F_DUMP, NLM_F_REPLACE, + NLM_F_REQUEST, +}; use netlink_packet_route::{ address, constants::*, @@ -23,14 +26,12 @@ fn if_nametoindex(interface: &InterfaceName) -> Result { pub fn set_up(interface: &InterfaceName, mtu: u32) -> Result<(), io::Error> { let index = if_nametoindex(interface)?; - let message = LinkMessage { - header: LinkHeader { - index, - flags: IFF_UP, - ..Default::default() - }, - nlas: vec![link::nlas::Nla::Mtu(mtu)], - }; + let mut header = LinkHeader::default(); + header.index = index; + header.flags = IFF_UP; + let mut message = LinkMessage::default(); + message.header = header; + message.nlas = vec![link::nlas::Nla::Mtu(mtu)]; netlink_request_rtnl(RtnlMessage::SetLink(message), None)?; log::debug!("set interface {} up with mtu {}", interface, mtu); Ok(()) @@ -54,16 +55,15 @@ pub fn set_addr(interface: &InterfaceName, addr: IpNet) -> Result<(), io::Error> vec![address::Nla::Address(network.addr().octets().to_vec())], ), }; - let message = AddressMessage { - header: AddressHeader { - index, - family, - prefix_len: addr.prefix_len(), - scope: RT_SCOPE_UNIVERSE, - ..Default::default() - }, - nlas, - }; + let mut header = AddressHeader::default(); + header.index = index; + header.family = family; + header.prefix_len = addr.prefix_len(); + header.scope = RT_SCOPE_UNIVERSE; + + let mut message = AddressMessage::default(); + message.header = header; + message.nlas = nlas; netlink_request_rtnl( RtnlMessage::NewAddress(message), Some(NLM_F_REQUEST | NLM_F_ACK | NLM_F_REPLACE | NLM_F_CREATE), @@ -78,18 +78,16 @@ pub fn add_route(interface: &InterfaceName, cidr: IpNet) -> Result (AF_INET as u8, network.network().octets().to_vec()), IpNet::V6(network) => (AF_INET6 as u8, network.network().octets().to_vec()), }; - let message = RouteMessage { - header: RouteHeader { - table: RT_TABLE_MAIN, - protocol: RTPROT_BOOT, - scope: RT_SCOPE_LINK, - kind: RTN_UNICAST, - destination_prefix_length: cidr.prefix_len(), - address_family, - ..Default::default() - }, - nlas: vec![route::Nla::Destination(dst), route::Nla::Oif(if_index)], - }; + let mut header = RouteHeader::default(); + header.table = RT_TABLE_MAIN; + header.protocol = RTPROT_BOOT; + header.scope = RT_SCOPE_LINK; + header.kind = RTN_UNICAST; + header.destination_prefix_length = cidr.prefix_len(); + header.address_family = address_family; + let mut message = RouteMessage::default(); + message.header = header; + message.nlas = vec![route::Nla::Destination(dst), route::Nla::Oif(if_index)]; match netlink_request_rtnl(RtnlMessage::NewRoute(message), None) { Ok(_) => { diff --git a/shared/src/types.rs b/shared/src/types.rs index b1e398d6..b112c45e 100644 --- a/shared/src/types.rs +++ b/shared/src/types.rs @@ -1,5 +1,8 @@ use anyhow::{anyhow, Error}; -use clap::Args; +use clap::{ + builder::{PossibleValuesParser, TypedValueParser}, + Args, +}; use ipnet::IpNet; use once_cell::sync::Lazy; use regex::Regex; @@ -286,7 +289,7 @@ pub struct RedeemContents { #[derive(Debug, Clone, PartialEq, Eq, Args)] pub struct InstallOpts { /// Set a specific interface name - #[clap(long, conflicts_with = "default-name")] + #[clap(long, conflicts_with = "default_name")] pub name: Option, /// Use the network name inside the invitation as the interface name @@ -305,7 +308,7 @@ pub struct AddPeerOpts { pub name: Option, /// Specify desired IP of new peer (within parent CIDR) - #[clap(long, conflicts_with = "auto-ip")] + #[clap(long, conflicts_with = "auto_ip")] pub ip: Option, /// Auto-assign the peer the first available IP within the CIDR @@ -398,7 +401,7 @@ pub struct ListenPortOpts { pub listen_port: Option, /// Unset the local listen port to use a randomized port - #[clap(short, long, conflicts_with = "listen-port")] + #[clap(short, long, conflicts_with = "listen_port")] pub unset: bool, /// Bypass confirmation @@ -433,7 +436,7 @@ pub struct NatOpts { /// ex. --exclude-nat-candidates '0.0.0.0/0' would report no candidates. pub exclude_nat_candidates: Vec, - #[clap(long, conflicts_with = "exclude-nat-candidates")] + #[clap(long, conflicts_with = "exclude_nat_candidates")] /// Don't report any candidates to coordinating server. /// Shorthand for --exclude-nat-candidates '0.0.0.0/0'. pub no_nat_candidates: bool, @@ -465,7 +468,7 @@ pub struct NetworkOpts { /// external tool like e.g. babeld. pub no_routing: bool, - #[clap(long, default_value_t, possible_values = Backend::variants())] + #[clap(long, default_value_t, value_parser = PossibleValuesParser::new(Backend::variants()).map(|s| s.parse::().unwrap()))] /// Specify a WireGuard backend to use. /// If not set, innernet will auto-select based on availability. pub backend: Backend, @@ -632,8 +635,6 @@ impl<'a> PeerDiff<'a> { // diff.new is now guaranteed to be a Some(_) variant. let new = new.unwrap(); - // TODO(jake): use contains() when stable: https://github.com/rust-lang/rust/issues/62358 - let new_allowed_ips = &[AllowedIp { address: new.ip, cidr: if new.ip.is_ipv4() { 32 } else { 128 }, diff --git a/wireguard-control/Cargo.toml b/wireguard-control/Cargo.toml index cb633562..83b7e50e 100644 --- a/wireguard-control/Cargo.toml +++ b/wireguard-control/Cargo.toml @@ -10,17 +10,18 @@ repository = "https://github.com/tonarino/innernet" version = "1.5.5" [dependencies] -base64 = "0.13" -hex = "0.4" +base64 = "0.13.1" +hex = "0.4.3" libc = "0.2" log = "0.4" rand_core = { version = "0.6", features = ["getrandom"] } -curve25519-dalek = "4.0.0-pre.2" +x25519-dalek = { version = "=2.0.0-rc.2", features = ["static_secrets"] } [target.'cfg(target_os = "linux")'.dependencies] netlink-request = { path = "../netlink-request" } netlink-sys = "0.8" -netlink-packet-core = "0.4" -netlink-packet-generic = "0.3" -netlink-packet-route = "0.13" +netlink-packet-core = "0.5" +netlink-packet-generic = "0.3.2" +netlink-packet-route = "0.15" +netlink-packet-utils = "0.5.2" netlink-packet-wireguard = "0.2" diff --git a/wireguard-control/src/backends/kernel.rs b/wireguard-control/src/backends/kernel.rs index 9c60bf10..a0c7e6c1 100644 --- a/wireguard-control/src/backends/kernel.rs +++ b/wireguard-control/src/backends/kernel.rs @@ -3,7 +3,7 @@ use crate::{ PeerConfigBuilder, PeerInfo, PeerStats, }; use netlink_packet_core::{ - NetlinkMessage, NetlinkPayload, NLM_F_ACK, NLM_F_CREATE, NLM_F_EXCL, NLM_F_REQUEST, + NetlinkMessage, NetlinkPayload, NLM_F_ACK, NLM_F_CREATE, NLM_F_DUMP, NLM_F_EXCL, NLM_F_REQUEST, }; use netlink_packet_generic::GenlMessage; use netlink_packet_route::{ @@ -12,9 +12,9 @@ use netlink_packet_route::{ self, nlas::{Info, InfoKind}, }, - traits::Emitable, LinkMessage, RtnlMessage, }; +use netlink_packet_utils::traits::Emitable; use netlink_packet_wireguard::{ self, constants::{WGDEVICE_F_REPLACE_PEERS, WGPEER_F_REMOVE_ME, WGPEER_F_REPLACE_ALLOWEDIPS}, diff --git a/wireguard-control/src/key.rs b/wireguard-control/src/key.rs index 69ed6d10..d9428c57 100644 --- a/wireguard-control/src/key.rs +++ b/wireguard-control/src/key.rs @@ -1,5 +1,7 @@ use std::{ffi::NulError, fmt}; +use x25519_dalek::{PublicKey, StaticSecret}; + /// Represents an error in base64 key parsing. #[derive(Eq, PartialEq, Debug, Clone)] pub struct InvalidKey; @@ -57,14 +59,10 @@ impl Key { /// Generates a public key for this private key. #[must_use] pub fn get_public(&self) -> Self { - use curve25519_dalek::scalar::Scalar; - - use curve25519_dalek::constants::ED25519_BASEPOINT_TABLE; - - // https://github.com/dalek-cryptography/x25519-dalek/blob/1c39ff92e0dfc0b24aa02d694f26f3b9539322a5/src/x25519.rs#L150 - let point = (&ED25519_BASEPOINT_TABLE * &Scalar::from_bits(self.0)).to_montgomery(); + let secret = StaticSecret::from(self.0); + let public = PublicKey::from(&secret); - Self(point.to_bytes()) + Self(public.to_bytes()) } /// Generates an all-zero key. From de7ec99ad93edbb30ba743ed63af240dbac61a17 Mon Sep 17 00:00:00 2001 From: Eva Pace Date: Fri, 2 Jun 2023 03:42:54 -0300 Subject: [PATCH 10/16] Optimize /etc/hosts writes (#259) * hostsfile: change internal map from hash to btree This change makes the innernet section of /etc/hosts always ordered and deterministic. We can take advantage of that to avoid writes, that will be done in another commit. * hostsfile: reduce number of writes if content hasn't changed * hostsfile: return bool to inform if file has been written This commit also makes the logs print accordingly to the new behavior. * hostsfile: remove has_content_changed in favor of comparing old and new sections * hostsfile: print the correct hosts path in log message * hostsfile: remove unnecessary intermediate variable --- client/src/main.rs | 15 +++++++---- hostsfile/src/lib.rs | 64 ++++++++++++++++++++++++++++---------------- 2 files changed, 51 insertions(+), 28 deletions(-) diff --git a/client/src/main.rs b/client/src/main.rs index 86095ee7..c1b3155c 100644 --- a/client/src/main.rs +++ b/client/src/main.rs @@ -279,8 +279,6 @@ fn update_hosts_file( hosts_path: PathBuf, peers: &[Peer], ) -> Result<(), WrappedIoError> { - log::info!("updating {} with the latest peers.", "/etc/hosts".yellow()); - let mut hosts_builder = HostsBuilder::new(format!("innernet {interface}")); for peer in peers { hosts_builder.add_hostname( @@ -288,9 +286,16 @@ fn update_hosts_file( &format!("{}.{}.wg", peer.contents.name, interface), ); } - if let Err(e) = hosts_builder.write_to(&hosts_path).with_path(hosts_path) { - log::warn!("failed to update hosts ({})", e); - } + match hosts_builder.write_to(&hosts_path).with_path(&hosts_path) { + Ok(has_written) if has_written => { + log::info!( + "updated {} with the latest peers.", + hosts_path.to_string_lossy().yellow() + ) + }, + Ok(_) => {}, + Err(e) => log::warn!("failed to update hosts ({})", e), + }; Ok(()) } diff --git a/hostsfile/src/lib.rs b/hostsfile/src/lib.rs index 7c055e55..b6ba2e18 100644 --- a/hostsfile/src/lib.rs +++ b/hostsfile/src/lib.rs @@ -1,5 +1,5 @@ use std::{ - collections::HashMap, + collections::BTreeMap, fmt, fs::OpenOptions, io::{self, BufRead, BufReader, ErrorKind, Write}, @@ -81,7 +81,7 @@ impl std::error::Error for Error { /// ``` pub struct HostsBuilder { tag: String, - hostname_map: HashMap>, + hostname_map: BTreeMap>, } impl HostsBuilder { @@ -90,7 +90,7 @@ impl HostsBuilder { pub fn new>(tag: S) -> Self { Self { tag: tag.into(), - hostname_map: HashMap::new(), + hostname_map: BTreeMap::new(), } } @@ -116,7 +116,8 @@ impl HostsBuilder { /// Inserts a new section to the system's default hosts file. If there is a section with the /// same tag name already, it will be replaced with the new list instead. - pub fn write(&self) -> io::Result<()> { + /// Returns true if the hosts file has changed. + pub fn write(&self) -> io::Result { self.write_to(Self::default_path()?) } @@ -178,7 +179,9 @@ impl HostsBuilder { /// /// On Windows, the format of one hostname per line will be used, all other systems will use /// the same format as Unix and Unix-like systems (i.e. allow multiple hostnames per line). - pub fn write_to>(&self, hosts_path: P) -> io::Result<()> { + /// + /// Returns true if the hosts file has changed. + pub fn write_to>(&self, hosts_path: P) -> io::Result { let hosts_path = hosts_path.as_ref(); if hosts_path.is_dir() { // TODO(jake): use io::ErrorKind::IsADirectory when it's stable. @@ -206,9 +209,31 @@ impl HostsBuilder { let begin = lines.iter().position(|line| line.trim() == begin_marker); let end = lines.iter().position(|line| line.trim() == end_marker); + let mut lines_to_insert = vec![]; + if !self.hostname_map.is_empty() { + lines_to_insert.push(begin_marker); + for (ip, hostnames) in &self.hostname_map { + if cfg!(windows) { + // windows only allows one hostname per line + for hostname in hostnames { + lines_to_insert.push(format!("{ip} {hostname}")); + } + } else { + // assume the same format as Unix + lines_to_insert.push(format!("{} {}", ip, hostnames.join(" "))); + } + } + lines_to_insert.push(end_marker); + } + let insert = match (begin, end) { (Some(begin), Some(end)) => { - lines.drain(begin..end + 1); + let old_section: Vec = lines.drain(begin..end + 1).collect(); + + if old_section == lines_to_insert { + return Ok(false); + } + begin }, (None, None) => { @@ -233,21 +258,12 @@ impl HostsBuilder { for line in &lines[..insert] { writeln!(s, "{line}")?; } - if !self.hostname_map.is_empty() { - writeln!(s, "{begin_marker}")?; - for (ip, hostnames) in &self.hostname_map { - if cfg!(windows) { - // windows only allows one hostname per line - for hostname in hostnames { - writeln!(s, "{ip} {hostname}")?; - } - } else { - // assume the same format as Unix - writeln!(s, "{} {}", ip, hostnames.join(" "))?; - } - } - writeln!(s, "{end_marker}")?; + + // Append hostnames_map section + for line in lines_to_insert { + writeln!(s, "{line}")?; } + for line in &lines[insert..] { writeln!(s, "{line}")?; } @@ -260,8 +276,9 @@ impl HostsBuilder { _ => { log::debug!("wrote hosts file with the write-and-swap strategy"); }, - } - Ok(()) + }; + + Ok(true) } fn write_and_swap(temp_path: &Path, hosts_path: &Path, contents: &[u8]) -> io::Result<()> { @@ -314,7 +331,8 @@ mod tests { temp_file.write_all(b"preexisting\ncontent").unwrap(); let mut builder = HostsBuilder::new("foo"); builder.add_hostname([1, 1, 1, 1].into(), "whatever"); - builder.write_to(&temp_path).unwrap(); + assert!(builder.write_to(&temp_path).unwrap()); + assert!(!builder.write_to(&temp_path).unwrap()); let contents = std::fs::read_to_string(&temp_path).unwrap(); println!("contents: {contents}"); From 68df16126443485965787235aea81e9f6ad52cc1 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Fri, 2 Jun 2023 09:45:40 +0300 Subject: [PATCH 11/16] build: drop 'inn' symlink from deb/rpm packaging (#175) --- client/.rpm/innernet.spec | 1 - client/Cargo.toml | 1 - 2 files changed, 2 deletions(-) diff --git a/client/.rpm/innernet.spec b/client/.rpm/innernet.spec index c9e2bf6c..7f3f1028 100644 --- a/client/.rpm/innernet.spec +++ b/client/.rpm/innernet.spec @@ -23,7 +23,6 @@ Requires: libgcc %setup -q %build -ln -s %{name} .%{_bindir}/inn %install rm -rf %{buildroot} diff --git a/client/Cargo.toml b/client/Cargo.toml index d8ec5b09..fa446def 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -37,7 +37,6 @@ tempfile = "3" [package.metadata.deb] assets = [ ["target/release/innernet", "usr/bin/", "755"], - ["target/release/innernet", "usr/bin/inn", "755"], ["innernet@.service", "usr/lib/systemd/system/", "644"], ["../doc/innernet.8.gz", "usr/share/man/man8/", "644"], ["../doc/innernet.completions.bash", "etc/bash_completion.d/innernet", "644"], From b3a9718abc49f61ba200b3b515cc3bfde62f338a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Laitl?= Date: Fri, 2 Jun 2023 09:56:56 +0200 Subject: [PATCH 12/16] Drop warning about using the inn symlink (#266) Follow-up to just-merged #175. We no longer install the `inn` symlink, so users doing that manually should know what they are doing. --- client/src/main.rs | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/client/src/main.rs b/client/src/main.rs index c1b3155c..6efc9572 100644 --- a/client/src/main.rs +++ b/client/src/main.rs @@ -1176,16 +1176,6 @@ fn main() { let opts = Opts::parse(); util::init_logger(opts.verbose); - let argv0 = std::env::args().next().unwrap(); - let executable = Path::new(&argv0).file_name().unwrap().to_str().unwrap(); - if executable == "inn" { - log::warn!(""); - log::warn!(" {}: the {} shortcut will be removed from OS packages soon in favor of users creating a shell alias.", "WARNING".bold(), "inn".yellow()); - log::warn!(""); - log::warn!(" See https://github.com/tonarino/innernet/issues/176 for instructions to continue using it."); - log::warn!(""); - } - if let Err(e) = run(&opts) { println!(); log::error!("{}\n", e); From c629e010764875bd0f185f3049687c26c15e78be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Laitl?= Date: Tue, 6 Jun 2023 05:21:11 +0200 Subject: [PATCH 13/16] =?UTF-8?q?meta:=20add=20Brian,=20Ryo,=20Mat=C4=9Bj?= =?UTF-8?q?=20as=20authors,=20canonicalize=20Jake's=20email=20(#267)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * meta: add Brian, Ryo, Matěj as authors, canonicalize Jake's email Follow-up to #252. * Also update shared/Cargo.toml Co-authored-by: Jake McGinty --------- Co-authored-by: Jake McGinty --- client/Cargo.toml | 12 +++++++++--- publicip/Cargo.toml | 2 +- server/Cargo.toml | 13 ++++++++++--- shared/Cargo.toml | 7 ++++++- wireguard-control/Cargo.toml | 2 +- 5 files changed, 27 insertions(+), 9 deletions(-) diff --git a/client/Cargo.toml b/client/Cargo.toml index fa446def..a5b5073d 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -1,11 +1,17 @@ [package] -authors = ["Jake McGinty "] +authors = [ + "Jake McGinty ", + "Brian Schwind ", + "Ryo Kawaguchi ", + "Matěj Laitl ", +] description = "A client to manage innernet network interfaces." edition = "2021" homepage = "https://github.com/tonarino/innernet" license = "MIT" name = "client" publish = false +readme = "README.md" repository = "https://github.com/tonarino/innernet" version = "1.5.5" @@ -61,8 +67,8 @@ buildflags = ["--release"] "../../doc/innernet.8.gz" = { path = "/usr/share/man/man8/innernet.8.gz" } "../innernet@.service" = { path = "/usr/lib/systemd/system/innernet@.service" } "../../doc/innernet.completions.bash" = { path = "/etc/bash_completion.d/innernet" } -"../../doc/innernet.completions.fish" = { path = "/usr/share/fish/vendor_completions.d/innernet.fish" } -"../../doc/innernet.completions.zsh" = { path = "/usr/share/zsh/site-functions/_innernet" } +"../../doc/innernet.completions.fish" = { path = "/usr/share/fish/vendor_completions.d/innernet.fish" } +"../../doc/innernet.completions.zsh" = { path = "/usr/share/zsh/site-functions/_innernet" } [package.metadata.rpm.targets] innernet = { path = "/usr/bin/innernet" } diff --git a/publicip/Cargo.toml b/publicip/Cargo.toml index 0caee0a4..4e985ee9 100644 --- a/publicip/Cargo.toml +++ b/publicip/Cargo.toml @@ -1,5 +1,5 @@ [package] -authors = ["Jake McGinty "] +authors = ["Jake McGinty "] edition = "2021" name = "publicip" version = "0.1.0" diff --git a/server/Cargo.toml b/server/Cargo.toml index c2afeecc..87db7858 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -1,11 +1,18 @@ [package] -authors = ["Jake McGinty "] +authors = [ + "Jake McGinty ", + "Brian Schwind ", + "Ryo Kawaguchi ", + "Matěj Laitl ", +] description = "A server to coordinate innernet networks." edition = "2021" +homepage = "https://github.com/tonarino/innernet" license = "MIT" name = "server" publish = false readme = "README.md" +repository = "https://github.com/tonarino/innernet" version = "1.5.5" [[bin]] @@ -81,8 +88,8 @@ buildflags = ["--release"] "../../doc/innernet-server.8.gz" = { path = "/usr/share/man/man8/innernet-server.8.gz" } "../innernet-server@.service" = { path = "/usr/lib/systemd/system/innernet-server@.service" } "../../doc/innernet-server.completions.bash" = { path = "/etc/bash_completion.d/innernet-server" } -"../../doc/innernet-server.completions.fish" = { path = "/usr/share/fish/vendor_completions.d/innernet-server.fish" } -"../../doc/innernet-server.completions.zsh" = { path = "/usr/share/zsh/site-functions/_innernet-server" } +"../../doc/innernet-server.completions.fish" = { path = "/usr/share/fish/vendor_completions.d/innernet-server.fish" } +"../../doc/innernet-server.completions.zsh" = { path = "/usr/share/zsh/site-functions/_innernet-server" } [package.metadata.rpm.targets] innernet-server = { path = "/usr/bin/innernet-server" } diff --git a/shared/Cargo.toml b/shared/Cargo.toml index 80d344dc..744a9699 100644 --- a/shared/Cargo.toml +++ b/shared/Cargo.toml @@ -1,5 +1,10 @@ [package] -authors = ["Jake McGinty "] +authors = [ + "Jake McGinty ", + "Brian Schwind ", + "Ryo Kawaguchi ", + "Matěj Laitl ", +] edition = "2021" license = "MIT" name = "shared" diff --git a/wireguard-control/Cargo.toml b/wireguard-control/Cargo.toml index 83b7e50e..846ba910 100644 --- a/wireguard-control/Cargo.toml +++ b/wireguard-control/Cargo.toml @@ -1,5 +1,5 @@ [package] -authors = ["K900 ", "Jake McGinty "] +authors = ["K900 ", "Jake McGinty "] categories = ["os::unix-apis"] description = "High level bindings to the WireGuard embeddable C library" edition = "2021" From 0998593d556dc2e0bf2509dba6493d7d3376bc83 Mon Sep 17 00:00:00 2001 From: Jake McGinty Date: Wed, 14 Jun 2023 02:29:56 -0500 Subject: [PATCH 14/16] update release.toml for latest cargo-release compat (#268) --- release.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/release.toml b/release.toml index f080b16c..08a14149 100644 --- a/release.toml +++ b/release.toml @@ -2,4 +2,3 @@ consolidate-commits = true publish = false push = false tag = false -dev-version = false From 8d058c8d879bdeec64506f2d34c2c55e2975ec28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Laitl?= Date: Wed, 14 Jun 2023 10:49:16 +0200 Subject: [PATCH 15/16] meta: release v1.6.0 (ran on Linux) (#270) * meta: release v1.6.0 * README: update release steps --- Cargo.lock | 10 +- README.md | 12 +- client/Cargo.toml | 2 +- doc/innernet-server.8 | 70 ++-- doc/innernet-server.8.gz | Bin 865 -> 844 bytes doc/innernet-server.completions.bash | 243 ++++++++++-- doc/innernet-server.completions.elvish | 81 ++-- doc/innernet-server.completions.fish | 41 +- doc/innernet-server.completions.powershell | 92 +++-- doc/innernet-server.completions.zsh | 200 ++++++++-- doc/innernet.8 | 72 ++-- doc/innernet.8.gz | Bin 1052 -> 1026 bytes doc/innernet.completions.bash | 440 ++++++++++++++++++--- doc/innernet.completions.elvish | 144 +++++-- doc/innernet.completions.fish | 74 ++-- doc/innernet.completions.powershell | 164 ++++++-- doc/innernet.completions.zsh | 326 ++++++++++++--- netlink-request/Cargo.toml | 2 +- server/Cargo.toml | 2 +- shared/Cargo.toml | 2 +- wireguard-control/Cargo.toml | 2 +- 21 files changed, 1546 insertions(+), 433 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 11c01402..f8309a72 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -190,7 +190,7 @@ checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" [[package]] name = "client" -version = "1.5.5" +version = "1.6.0" dependencies = [ "anyhow", "clap", @@ -751,7 +751,7 @@ dependencies = [ [[package]] name = "netlink-request" -version = "1.5.5" +version = "1.6.0" dependencies = [ "netlink-packet-core", "netlink-packet-generic", @@ -1050,7 +1050,7 @@ dependencies = [ [[package]] name = "server" -version = "1.5.5" +version = "1.6.0" dependencies = [ "anyhow", "bytes", @@ -1085,7 +1085,7 @@ dependencies = [ [[package]] name = "shared" -version = "1.5.5" +version = "1.6.0" dependencies = [ "anyhow", "atty", @@ -1591,7 +1591,7 @@ dependencies = [ [[package]] name = "wireguard-control" -version = "1.5.5" +version = "1.6.0" dependencies = [ "base64", "hex", diff --git a/README.md b/README.md index 8bd30fa0..221caad0 100644 --- a/README.md +++ b/README.md @@ -216,10 +216,10 @@ brew install tonarino/innernet/innernet ```sh # to install innernet: -cargo install --git https://github.com/tonarino/innernet --tag v1.5.5 client +cargo install --git https://github.com/tonarino/innernet --tag v1.6.0 client # to install innernet-server: -cargo install --git https://github.com/tonarino/innernet --tag v1.5.5 server +cargo install --git https://github.com/tonarino/innernet --tag v1.6.0 server ``` Note that you'll be responsible for updating manually. @@ -255,6 +255,8 @@ The resulting binary will be located at `./target/release/innernet` ### Releases -1. Run `cargo release [--dry-run] [minor|major|patch|...]` to automatically bump the crates appropriately. -2. Create a new git tag (ex. `v0.6.0`). -3. Push (with tags) to the repo. +Please run the release script from a Linux machine: generated shell completions depend on available wireguard backends and Mac doesn't support the `kernel` backend. + +1. Fetch and check-out the `main` branch. +2. Run `./release.sh [patch|major|minor|rc]` +3. Push the `main` branch and the created tag to the repo. diff --git a/client/Cargo.toml b/client/Cargo.toml index a5b5073d..a82f39e9 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -13,7 +13,7 @@ name = "client" publish = false readme = "README.md" repository = "https://github.com/tonarino/innernet" -version = "1.5.5" +version = "1.6.0" [[bin]] name = "innernet" diff --git a/doc/innernet-server.8 b/doc/innernet-server.8 index 79c2dffb..8ce9d074 100644 --- a/doc/innernet-server.8 +++ b/doc/innernet-server.8 @@ -1,48 +1,19 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.2. -.TH INNERNET-SERVER "8" "September 2022" "innernet-server 1.5.5" "System Administration Utilities" +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. +.TH INNERNET-SERVER "8" "June 2023" "innernet-server 1.6.0" "System Administration Utilities" .SH NAME -innernet-server \- manual page for innernet-server 1.5.5 +innernet-server \- manual page for innernet-server 1.6.0 +.SH SYNOPSIS +.B innernet-server +[\fI\,OPTIONS\/\fR] \fI\,\/\fR .SH DESCRIPTION -innernet\-server 1.5.5 -Jake McGinty A server to coordinate innernet networks. -.SS "USAGE:" -.IP -innernet\-server [OPTIONS] -.SS "OPTIONS:" -.TP -\fB\-c\fR, \fB\-\-config\-dir\fR -[default: /etc/innernet\-server] -.TP -\fB\-d\fR, \fB\-\-data\-dir\fR -[default: /var/lib/innernet\-server] -.TP -\fB\-\-no\-routing\fR -Whether the routing should be done by innernet or is done by an -external tool like e.g. babeld -.TP -\fB\-\-backend\fR -Specify a WireGuard backend to use. If not set, innernet will -auto\-select based on availability [default: kernel] [possible -values: kernel, userspace] -.TP -\fB\-\-mtu\fR -Specify the desired MTU for your interface (default: 1280) -.TP -\fB\-h\fR, \fB\-\-help\fR -Print help information -.TP -\fB\-V\fR, \fB\-\-version\fR -Print version information -.SS "SUBCOMMANDS:" +.SS "Commands:" .TP new Create a new network .TP uninstall -Permanently uninstall a created network, rendering it unusable. Use with -.IP -care +Permanently uninstall a created network, rendering it unusable. Use with care .TP serve Serve the coordinating server for an existing network @@ -70,3 +41,28 @@ Generate shell completion scripts .TP help Print this message or the help of the given subcommand(s) +.SH OPTIONS +.TP +\fB\-c\fR, \fB\-\-config\-dir\fR +[default: /etc/innernet\-server] +.TP +\fB\-d\fR, \fB\-\-data\-dir\fR +[default: /var/lib/innernet\-server] +.TP +\fB\-\-no\-routing\fR +Whether the routing should be done by innernet or is done by an +external tool like e.g. babeld +.TP +\fB\-\-backend\fR +Specify a WireGuard backend to use. If not set, innernet will +auto\-select based on availability [default: kernel] [possible +values: kernel, userspace] +.TP +\fB\-\-mtu\fR +Specify the desired MTU for your interface (default: 1280) +.TP +\fB\-h\fR, \fB\-\-help\fR +Print help +.TP +\fB\-V\fR, \fB\-\-version\fR +Print version diff --git a/doc/innernet-server.8.gz b/doc/innernet-server.8.gz index 3062d2bee352d49f29dc393394d4cc0b6836b53a..296d82c1d4cd333f819928a5b9bcbd37501f8835 100644 GIT binary patch literal 844 zcmV-S1GD@eiwFo^e2HWL18HtG7)Zmvf_gl$!ARwolrz*=J?+kxfZ-`E7gZtwa5o{KVg2C6>yXNoxTCc9PF5dB`P$`A&12tRwy@DYo_3R{PEBDLmb8PJIL}po#p9# zP^7c(=?r?GdeHl;Q3zL;S089C6iFy_1B+&hhRA=!mlQAd*5Mk4d@Yo)jgDz`ooPOe6z-ytLC;_W-5ud!vr$4>$E1v=Xo!W%$vvE+#Ha$5A6b1cs5ly-mLMD< z8_O0FW4N~nJK8jM29Uc2_MAttgv0_^@d_(QXAd2V*!?CLPEC%wlZSlY+(3#iKcWjj@m6OtkGI; zSZc9vzuyL3hxJlyk;u)WI(X%+eHUEUdNatC^)(eoe(Xb7(uY>HSe64W426MQo8M%& z|0LP$YxKaeW{q^8;R0QCar9={djGML>F*FY|tKe`aYYn8&=_qhOJ!_ zY97z;yLx@QI9jTi18s!q-0Q}_chrxXG~n$i^ZTn$m+v~s)%mr0ulaj8xG@;>1pIyu Wqf7Z7akAl17YEs55?yV{kmO|f_eUvCoNl*$NFb4X9@6APg;@_qGnmen zFqw^#hreO@n56KK{1yKOkXYC=0~?g6nMDry0k&AygNjMG34i}19E3r*e1v2=jTh5+ z*-zuemv{la4?XCmSX-=e)G&BA7?43o;*n_k2KA22H{tv6y$d`T3WSJPLJDIkl~58^ zR+PdDG`%29A7L6z;^2FRtPfO5!%C>x24Sr<{BIJ^FpAURBAG9f+4M}5y$<`6y&z1A zv5@uvw-tW+mkgn4?t%!~K&zloN^>EpBj;>DzrE5ghWe4F&|9U^IQ~eLC-Wb3JtNY<>GKr?6yCbl5Ip}g8Wb6B^Uu5gW75F1vlw6BV*5^W#8E%KO=|eL9XOt}N zf+vn^)|B=mT%#?nzt8*JQSwVl&MfN)N6|9+fo{k2bt&>+QD%Lqvc6W06>>vN!PhO? zt!vm8p*4fqs-`3vA#f$p$?4ocH#&1RGa2AFOCB1nRjPzi&}1;&gpjiwOMaO+XT=Lj z?#sWAhM!~C&9ufstceM}3XS82Y07&HbTe!WhLEg5Doc~KS6v}{QI-K~ta2Y&Vqpnp zNc$v7wqv4XxzptVy7s&{VEGJBwK7KJB?dcIHfTGpc*G^>c^Tm;LSPn&EUhkw;kp7a;$Dq-5lnckbZ56g4im*ULEMmC5UEf z$lKvs!)vG$YNyhBjP_xF+6nJ$q>#okYV90}N20Xl0nS!J6duY?s4LJk zD%4Ik!ct^o7_~Npl|h=3-TK`sm`2a<^%$h?-?#9*qh5B$y>qRkhYP>aBje1M^)b$~ zevPPuh;ypO9i2{o7SDw*r^SqpHyi@%7Y&t=sqZs9MlvY!Ke zsfFODQeCTu$!PJ*a!JV+TiD272innernet-server" \ && ret=0 @@ -37,30 +37,30 @@ _innernet-server() { case $line[1] in (new) _arguments "${_arguments_options[@]}" \ -'--network-name=[The network name (ex: evilcorp)]:NETWORK_NAME: ' \ -'--network-cidr=[The network CIDR (ex: 10.42.0.0/16)]:NETWORK_CIDR: ' \ -'(--auto-external-endpoint)--external-endpoint=[This server'\''s external endpoint (ex: 100.100.100.100:51820)]:EXTERNAL_ENDPOINT: ' \ +'--network-name=[The network name (ex\: evilcorp)]:NETWORK_NAME: ' \ +'--network-cidr=[The network CIDR (ex\: 10.42.0.0/16)]:NETWORK_CIDR: ' \ +'(--auto-external-endpoint)--external-endpoint=[This server'\''s external endpoint (ex\: 100.100.100.100\:51820)]:EXTERNAL_ENDPOINT: ' \ '--listen-port=[Port to listen on (for the WireGuard interface)]:LISTEN_PORT: ' \ '--auto-external-endpoint[Auto-resolve external endpoint]' \ -'-h[Print help information]' \ -'--help[Print help information]' \ +'-h[Print help]' \ +'--help[Print help]' \ && ret=0 ;; (uninstall) _arguments "${_arguments_options[@]}" \ '--yes[Bypass confirmation]' \ -'-h[Print help information]' \ -'--help[Print help information]' \ +'-h[Print help]' \ +'--help[Print help]' \ ':interface:' \ && ret=0 ;; (serve) _arguments "${_arguments_options[@]}" \ '--backend=[Specify a WireGuard backend to use. If not set, innernet will auto-select based on availability]:BACKEND:(kernel userspace)' \ -'--mtu=[Specify the desired MTU for your interface (default: 1280)]:MTU: ' \ +'--mtu=[Specify the desired MTU for your interface (default\: 1280)]:MTU: ' \ '--no-routing[Whether the routing should be done by innernet or is done by an external tool like e.g. babeld]' \ -'-h[Print help information]' \ -'--help[Print help information]' \ +'-h[Print help]' \ +'--help[Print help]' \ ':interface:' \ && ret=0 ;; @@ -69,27 +69,27 @@ _arguments "${_arguments_options[@]}" \ '--name=[Name of new peer]:NAME: ' \ '(--auto-ip)--ip=[Specify desired IP of new peer (within parent CIDR)]:IP: ' \ '--cidr=[Name of CIDR to add new peer under]:CIDR: ' \ -'--admin=[Make new peer an admin?]:ADMIN: ' \ +'--admin=[Make new peer an admin?]:ADMIN:(true false)' \ '--save-config=[Save the config to the given location]:SAVE_CONFIG: ' \ '--invite-expires=[Invite expiration period (eg. '\''30d'\'', '\''7w'\'', '\''2h'\'', '\''60m'\'', '\''1000s'\'')]:INVITE_EXPIRES: ' \ '--auto-ip[Auto-assign the peer the first available IP within the CIDR]' \ '--yes[Bypass confirmation]' \ -'-h[Print help information]' \ -'--help[Print help information]' \ +'-h[Print help]' \ +'--help[Print help]' \ ':interface:' \ && ret=0 ;; (disable-peer) _arguments "${_arguments_options[@]}" \ -'-h[Print help information]' \ -'--help[Print help information]' \ +'-h[Print help]' \ +'--help[Print help]' \ ':interface:' \ && ret=0 ;; (enable-peer) _arguments "${_arguments_options[@]}" \ -'-h[Print help information]' \ -'--help[Print help information]' \ +'-h[Print help]' \ +'--help[Print help]' \ ':interface:' \ && ret=0 ;; @@ -98,8 +98,8 @@ _arguments "${_arguments_options[@]}" \ '--name=[Name of peer to rename]:NAME: ' \ '--new-name=[The new name of the peer]:NEW_NAME: ' \ '--yes[Bypass confirmation]' \ -'-h[Print help information]' \ -'--help[Print help information]' \ +'-h[Print help]' \ +'--help[Print help]' \ ':interface:' \ && ret=0 ;; @@ -109,8 +109,8 @@ _arguments "${_arguments_options[@]}" \ '--cidr=[The CIDR network (eg. '\''10.42.5.0/24'\'')]:CIDR: ' \ '--parent=[The CIDR parent name]:PARENT: ' \ '--yes[Bypass confirmation]' \ -'-h[Print help information]' \ -'--help[Print help information]' \ +'-h[Print help]' \ +'--help[Print help]' \ ':interface:' \ && ret=0 ;; @@ -118,26 +118,81 @@ _arguments "${_arguments_options[@]}" \ _arguments "${_arguments_options[@]}" \ '--name=[The CIDR name (eg. '\''engineers'\'')]:NAME: ' \ '--yes[Bypass confirmation]' \ -'-h[Print help information]' \ -'--help[Print help information]' \ +'-h[Print help]' \ +'--help[Print help]' \ ':interface:' \ && ret=0 ;; (completions) _arguments "${_arguments_options[@]}" \ -'-h[Print help information]' \ -'--help[Print help information]' \ +'-h[Print help]' \ +'--help[Print help]' \ ':shell:(bash elvish fish powershell zsh)' \ && ret=0 ;; (help) _arguments "${_arguments_options[@]}" \ -'*::subcommand -- The subcommand whose help message to display:' \ +":: :_innernet-server__help_commands" \ +"*::: :->help" \ +&& ret=0 + + case $state in + (help) + words=($line[1] "${words[@]}") + (( CURRENT += 1 )) + curcontext="${curcontext%:*:*}:innernet-server-help-command-$line[1]:" + case $line[1] in + (new) +_arguments "${_arguments_options[@]}" \ +&& ret=0 +;; +(uninstall) +_arguments "${_arguments_options[@]}" \ +&& ret=0 +;; +(serve) +_arguments "${_arguments_options[@]}" \ +&& ret=0 +;; +(add-peer) +_arguments "${_arguments_options[@]}" \ +&& ret=0 +;; +(disable-peer) +_arguments "${_arguments_options[@]}" \ +&& ret=0 +;; +(enable-peer) +_arguments "${_arguments_options[@]}" \ +&& ret=0 +;; +(rename-peer) +_arguments "${_arguments_options[@]}" \ +&& ret=0 +;; +(add-cidr) +_arguments "${_arguments_options[@]}" \ +&& ret=0 +;; +(delete-cidr) +_arguments "${_arguments_options[@]}" \ +&& ret=0 +;; +(completions) +_arguments "${_arguments_options[@]}" \ +&& ret=0 +;; +(help) +_arguments "${_arguments_options[@]}" \ && ret=0 ;; esac ;; esac +;; + esac + ;; +esac } (( $+functions[_innernet-server_commands] )) || @@ -162,55 +217,126 @@ _innernet-server__add-cidr_commands() { local commands; commands=() _describe -t commands 'innernet-server add-cidr commands' commands "$@" } +(( $+functions[_innernet-server__help__add-cidr_commands] )) || +_innernet-server__help__add-cidr_commands() { + local commands; commands=() + _describe -t commands 'innernet-server help add-cidr commands' commands "$@" +} (( $+functions[_innernet-server__add-peer_commands] )) || _innernet-server__add-peer_commands() { local commands; commands=() _describe -t commands 'innernet-server add-peer commands' commands "$@" } +(( $+functions[_innernet-server__help__add-peer_commands] )) || +_innernet-server__help__add-peer_commands() { + local commands; commands=() + _describe -t commands 'innernet-server help add-peer commands' commands "$@" +} (( $+functions[_innernet-server__completions_commands] )) || _innernet-server__completions_commands() { local commands; commands=() _describe -t commands 'innernet-server completions commands' commands "$@" } +(( $+functions[_innernet-server__help__completions_commands] )) || +_innernet-server__help__completions_commands() { + local commands; commands=() + _describe -t commands 'innernet-server help completions commands' commands "$@" +} (( $+functions[_innernet-server__delete-cidr_commands] )) || _innernet-server__delete-cidr_commands() { local commands; commands=() _describe -t commands 'innernet-server delete-cidr commands' commands "$@" } +(( $+functions[_innernet-server__help__delete-cidr_commands] )) || +_innernet-server__help__delete-cidr_commands() { + local commands; commands=() + _describe -t commands 'innernet-server help delete-cidr commands' commands "$@" +} (( $+functions[_innernet-server__disable-peer_commands] )) || _innernet-server__disable-peer_commands() { local commands; commands=() _describe -t commands 'innernet-server disable-peer commands' commands "$@" } +(( $+functions[_innernet-server__help__disable-peer_commands] )) || +_innernet-server__help__disable-peer_commands() { + local commands; commands=() + _describe -t commands 'innernet-server help disable-peer commands' commands "$@" +} (( $+functions[_innernet-server__enable-peer_commands] )) || _innernet-server__enable-peer_commands() { local commands; commands=() _describe -t commands 'innernet-server enable-peer commands' commands "$@" } +(( $+functions[_innernet-server__help__enable-peer_commands] )) || +_innernet-server__help__enable-peer_commands() { + local commands; commands=() + _describe -t commands 'innernet-server help enable-peer commands' commands "$@" +} (( $+functions[_innernet-server__help_commands] )) || _innernet-server__help_commands() { - local commands; commands=() + local commands; commands=( +'new:Create a new network' \ +'uninstall:Permanently uninstall a created network, rendering it unusable. Use with care' \ +'serve:Serve the coordinating server for an existing network' \ +'add-peer:Add a peer to an existing network' \ +'disable-peer:Disable an enabled peer' \ +'enable-peer:Enable a disabled peer' \ +'rename-peer:Rename an existing peer' \ +'add-cidr:Add a new CIDR to an existing network' \ +'delete-cidr:Delete a CIDR' \ +'completions:Generate shell completion scripts' \ +'help:Print this message or the help of the given subcommand(s)' \ + ) _describe -t commands 'innernet-server help commands' commands "$@" } +(( $+functions[_innernet-server__help__help_commands] )) || +_innernet-server__help__help_commands() { + local commands; commands=() + _describe -t commands 'innernet-server help help commands' commands "$@" +} +(( $+functions[_innernet-server__help__new_commands] )) || +_innernet-server__help__new_commands() { + local commands; commands=() + _describe -t commands 'innernet-server help new commands' commands "$@" +} (( $+functions[_innernet-server__new_commands] )) || _innernet-server__new_commands() { local commands; commands=() _describe -t commands 'innernet-server new commands' commands "$@" } +(( $+functions[_innernet-server__help__rename-peer_commands] )) || +_innernet-server__help__rename-peer_commands() { + local commands; commands=() + _describe -t commands 'innernet-server help rename-peer commands' commands "$@" +} (( $+functions[_innernet-server__rename-peer_commands] )) || _innernet-server__rename-peer_commands() { local commands; commands=() _describe -t commands 'innernet-server rename-peer commands' commands "$@" } +(( $+functions[_innernet-server__help__serve_commands] )) || +_innernet-server__help__serve_commands() { + local commands; commands=() + _describe -t commands 'innernet-server help serve commands' commands "$@" +} (( $+functions[_innernet-server__serve_commands] )) || _innernet-server__serve_commands() { local commands; commands=() _describe -t commands 'innernet-server serve commands' commands "$@" } +(( $+functions[_innernet-server__help__uninstall_commands] )) || +_innernet-server__help__uninstall_commands() { + local commands; commands=() + _describe -t commands 'innernet-server help uninstall commands' commands "$@" +} (( $+functions[_innernet-server__uninstall_commands] )) || _innernet-server__uninstall_commands() { local commands; commands=() _describe -t commands 'innernet-server uninstall commands' commands "$@" } -_innernet-server "$@" +if [ "$funcstack[1]" = "_innernet-server" ]; then + _innernet-server "$@" +else + compdef _innernet-server innernet-server +fi diff --git a/doc/innernet.8 b/doc/innernet.8 index a5525353..14e482aa 100644 --- a/doc/innernet.8 +++ b/doc/innernet.8 @@ -1,43 +1,13 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.2. -.TH INNERNET "8" "September 2022" "innernet 1.5.5" "System Administration Utilities" +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. +.TH INNERNET "8" "June 2023" "innernet 1.6.0" "System Administration Utilities" .SH NAME -innernet \- manual page for innernet 1.5.5 +innernet \- manual page for innernet 1.6.0 +.SH SYNOPSIS +.B innernet +[\fI\,OPTIONS\/\fR] [\fI\,COMMAND\/\fR] .SH DESCRIPTION -innernet 1.5.5 -Jake McGinty A client to manage innernet network interfaces. -.SS "USAGE:" -.IP -innernet [OPTIONS] [SUBCOMMAND] -.SS "OPTIONS:" -.TP -\fB\-v\fR, \fB\-\-verbose\fR -Verbose output, use \fB\-vv\fR for even higher verbositude -.TP -\fB\-c\fR, \fB\-\-config\-dir\fR -[default: /etc/innernet] -.TP -\fB\-d\fR, \fB\-\-data\-dir\fR -[default: /var/lib/innernet] -.TP -\fB\-\-no\-routing\fR -Whether the routing should be done by innernet or is done by an -external tool like e.g. babeld -.TP -\fB\-\-backend\fR -Specify a WireGuard backend to use. If not set, innernet will -auto\-select based on availability [default: kernel] [possible -values: kernel, userspace] -.TP -\fB\-\-mtu\fR -Specify the desired MTU for your interface (default: 1280) -.TP -\fB\-h\fR, \fB\-\-help\fR -Print help information -.TP -\fB\-V\fR, \fB\-\-version\fR -Print version information -.SS "SUBCOMMANDS:" +.SS "Commands:" .TP install Install a new innernet config @@ -98,3 +68,31 @@ Generate shell completion scripts .TP help Print this message or the help of the given subcommand(s) +.SH OPTIONS +.TP +\fB\-v\fR, \fB\-\-verbose\fR... +Verbose output, use \fB\-vv\fR for even higher verbositude +.TP +\fB\-c\fR, \fB\-\-config\-dir\fR +[default: /etc/innernet] +.TP +\fB\-d\fR, \fB\-\-data\-dir\fR +[default: /var/lib/innernet] +.TP +\fB\-\-no\-routing\fR +Whether the routing should be done by innernet or is done by an +external tool like e.g. babeld +.TP +\fB\-\-backend\fR +Specify a WireGuard backend to use. If not set, innernet will +auto\-select based on availability [default: kernel] [possible +values: kernel, userspace] +.TP +\fB\-\-mtu\fR +Specify the desired MTU for your interface (default: 1280) +.TP +\fB\-h\fR, \fB\-\-help\fR +Print help +.TP +\fB\-V\fR, \fB\-\-version\fR +Print version diff --git a/doc/innernet.8.gz b/doc/innernet.8.gz index c6483fb136fdcea32d1eecffc5cb0acdc9829225..6c27d85024b596bff3e2d338e1b736e41b922f71 100644 GIT binary patch literal 1026 zcmV+d1pWITiwFo^e2HWL18Htz0S3CVH|i{&i7{Q~Rz zIECBzpG)t)PO6aD^Y^fqGA`X1sWnXi)h8b&Hl z>2wu)Q8t0Rl&CCN?QA=+NmiKm6vX<0{5O`DC5yv9 zaMC>XFu7KR+Q}&EBUOobXUgVeXP-ylhjkn_8+ZG!;DSriN1IyzHGh2XcX! z!XZg2ptL(E>0&HYh$K&0_ecfWe8+Cxcc}9cXh5+$d>N@xr&u3PCqn!sV_sJ1qiQ2? zM-STDd5!-z^1#bB^{~-sD^&D5eyYif&8Ct2yYuTp&f%Ag8 zLDF^@s3AbDXMxFUS=pfBRvde%gB59DkH)wSKzqj- zbZpRtKX2uM;xNr753~Q;ocUeSZX6Gn6*t-VKx^h4{E;qLZ?r)oMNz~)g&XL`R*gM} zhR#99DfxAW&dN@1U1UL7+D2dxpAX@~X354v)(+sqbeY`7cmK@d)iwJnu;5K;-@^qB z{>5oTzx7aJ2t^x#_dv7Bdh!d*f!7zM+`I&pjg`*EH3dd3LkR5i4t;f8>RK|DLN_Hn zEl49y?*=_F-QIAE-gIQHSl0$tYu80j2pDZ6*zgUOVrY27^C#*E@Al1P`u9AUU9+^p zTo!}`pJk1A4X?>=5OkeGiH{&IKxs?uM3v|qIZE1Xys;FGp$W<@sTrD3Y8-yxvg8~0 zd_6;-mM5oJ(qmI;V&M<-mo9;Zd=@|q-x7W- w28*+^{O0Q21;Q#;t literal 1052 zcmV+%1mpW3iwFp#gf3$M18HtZYe~x=`6ff=|nNCOZ>1Y9+PaWu_ zSXkVxu!P?GUXKohA_9e$FdyTO&f{pv1NwX?lrWaag;ub%LJBL;bfP%DgK2*_j``$aOFMlZ~NvL}Q|J{HOz;p$)7{b99YrHGZjj{1;G zfy#o_?jCo=8Bc!)T|Uu)#d6JZG?aCkLT8!w$D=P4ZF1k-_Av9;r;qTEE^h|2$)rCW zJ_bN-a*)M+l&x>F?mk=3FTgKpgXKyaq@(CtSc0x>QP~TqXdM6!;q%8mD%gt6mMR^P z!d4s`?!3*NYqb`etjk5|2(AXR>1{IpXPC^dqX&*_R!RE>F45+fr(7NzD&D5z%(8}P z*kAO2qS>?ZQi|1UR9RQ)tXooILTy~C-?wO84)g={F_^8cBnb|IYlTjD=K{OVoAWVK z5&odQC{l*iT7neRXN)&7tk?=AZ(qD(`4cMc!@lVc{u)h(*HKzvF4n{Z-$jYzij{P4 zaCB;*!pD%TL1_yHsT1cw4noR^RhF_bC^5GLGxSPG%52YsWGkoVBQ#}sazIJSD6}zR zB{AAFS)n;ue49&Ckj9=BY-cMU^JKAX;&tWXXeee5Wbl$W>Z)vX3UALhf9QRB|E{6j zw%h5RwClrtNl5>|iGtX6{#iDlZ!e^3$lBoQgXd5u`sNj!gfEn_jB1yJ|5SN}ho-JU zsos-haEL~#+W7$l&bjTTsOWT$@xE0N-IPu{RT1hSb=#q^(xsf0ZD$ z)HCYMfu1s*g;*_CiIzco^@R`QJ?d=#D43HB`UVV+CKLiaygqlHW$2&9VEkf zh?BH#v9=HWhFs2OmwPap=qs(gC3J`j!$|b?wZpJ;^`HP~#hU=aLG3tF!4GOYe-S7% zM&}|Z&c{pduQ{R_Vh>1@vK2?2K^u5V5`WOI>zy|R%PVl2AX(ROprY(_ zX`_^6;PvB$6-?kQ&R^5BDg~!tX&e=rx*W~wqoBw0@H^Rwj0Hv-CFDx~6gN&Y+D}+}Fue WE25$gDt~L2mk'')' + cand add-peer 'Add a new peer' + cand rename-peer 'Rename a peer' + cand add-cidr 'Add a new CIDR' + cand delete-cidr 'Delete a CIDR' + cand list-cidrs 'List CIDRs' + cand disable-peer 'Disable an enabled peer' + cand enable-peer 'Enable a disabled peer' + cand add-association 'Add an association between CIDRs' + cand delete-association 'Delete an association between CIDRs' + cand list-associations 'List existing assocations between CIDRs' + cand set-listen-port 'Set the local listen port' + cand override-endpoint 'Override your external endpoint that the server sends to other peers' + cand completions 'Generate shell completion scripts' + cand help 'Print this message or the help of the given subcommand(s)' + } + &'innernet;help;install'= { + } + &'innernet;help;show'= { + } + &'innernet;help;up'= { + } + &'innernet;help;fetch'= { + } + &'innernet;help;uninstall'= { + } + &'innernet;help;down'= { + } + &'innernet;help;add-peer'= { + } + &'innernet;help;rename-peer'= { + } + &'innernet;help;add-cidr'= { + } + &'innernet;help;delete-cidr'= { + } + &'innernet;help;list-cidrs'= { + } + &'innernet;help;disable-peer'= { + } + &'innernet;help;enable-peer'= { + } + &'innernet;help;add-association'= { + } + &'innernet;help;delete-association'= { + } + &'innernet;help;list-associations'= { + } + &'innernet;help;set-listen-port'= { + } + &'innernet;help;override-endpoint'= { + } + &'innernet;help;completions'= { + } + &'innernet;help;help'= { } ] $completions[$command] diff --git a/doc/innernet.completions.fish b/doc/innernet.completions.fish index fbac7adc..058fc68e 100644 --- a/doc/innernet.completions.fish +++ b/doc/innernet.completions.fish @@ -1,11 +1,11 @@ -complete -c innernet -n "__fish_use_subcommand" -s c -l config-dir -r -complete -c innernet -n "__fish_use_subcommand" -s d -l data-dir -r +complete -c innernet -n "__fish_use_subcommand" -s c -l config-dir -r -F +complete -c innernet -n "__fish_use_subcommand" -s d -l data-dir -r -F complete -c innernet -n "__fish_use_subcommand" -l backend -d 'Specify a WireGuard backend to use. If not set, innernet will auto-select based on availability' -r -f -a "{kernel ,userspace }" complete -c innernet -n "__fish_use_subcommand" -l mtu -d 'Specify the desired MTU for your interface (default: 1280)' -r -complete -c innernet -n "__fish_use_subcommand" -s h -l help -d 'Print help information' -complete -c innernet -n "__fish_use_subcommand" -s V -l version -d 'Print version information' complete -c innernet -n "__fish_use_subcommand" -s v -l verbose -d 'Verbose output, use -vv for even higher verbositude' complete -c innernet -n "__fish_use_subcommand" -l no-routing -d 'Whether the routing should be done by innernet or is done by an external tool like e.g. babeld' +complete -c innernet -n "__fish_use_subcommand" -s h -l help -d 'Print help' +complete -c innernet -n "__fish_use_subcommand" -s V -l version -d 'Print version' complete -c innernet -n "__fish_use_subcommand" -f -a "install" -d 'Install a new innernet config' complete -c innernet -n "__fish_use_subcommand" -f -a "show" -d 'Enumerate all innernet connections' complete -c innernet -n "__fish_use_subcommand" -f -a "up" -d 'Bring up your local interface, and update it with latest peer list' @@ -26,7 +26,7 @@ complete -c innernet -n "__fish_use_subcommand" -f -a "set-listen-port" -d 'Set complete -c innernet -n "__fish_use_subcommand" -f -a "override-endpoint" -d 'Override your external endpoint that the server sends to other peers' complete -c innernet -n "__fish_use_subcommand" -f -a "completions" -d 'Generate shell completion scripts' complete -c innernet -n "__fish_use_subcommand" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' -complete -c innernet -n "__fish_seen_subcommand_from install" -l hosts-path -d 'The path to write hosts to' -r +complete -c innernet -n "__fish_seen_subcommand_from install" -l hosts-path -d 'The path to write hosts to' -r -F complete -c innernet -n "__fish_seen_subcommand_from install" -l name -d 'Set a specific interface name' -r complete -c innernet -n "__fish_seen_subcommand_from install" -l exclude-nat-candidates -d 'Exclude one or more CIDRs from NAT candidate reporting. ex. --exclude-nat-candidates \'0.0.0.0/0\' would report no candidates' -r complete -c innernet -n "__fish_seen_subcommand_from install" -l no-write-hosts -d 'Don\'t write to any hosts files' @@ -34,63 +34,83 @@ complete -c innernet -n "__fish_seen_subcommand_from install" -l default-name -d complete -c innernet -n "__fish_seen_subcommand_from install" -s d -l delete-invite -d 'Delete the invitation after a successful install' complete -c innernet -n "__fish_seen_subcommand_from install" -l no-nat-traversal -d 'Don\'t attempt NAT traversal. Note that this still will report candidates unless you also specify to exclude all NAT candidates' complete -c innernet -n "__fish_seen_subcommand_from install" -l no-nat-candidates -d 'Don\'t report any candidates to coordinating server. Shorthand for --exclude-nat-candidates \'0.0.0.0/0\'' -complete -c innernet -n "__fish_seen_subcommand_from install" -s h -l help -d 'Print help information' +complete -c innernet -n "__fish_seen_subcommand_from install" -s h -l help -d 'Print help' complete -c innernet -n "__fish_seen_subcommand_from show" -s s -l short -d 'One-line peer list' complete -c innernet -n "__fish_seen_subcommand_from show" -s t -l tree -d 'Display peers in a tree based on the CIDRs' -complete -c innernet -n "__fish_seen_subcommand_from show" -s h -l help -d 'Print help information' +complete -c innernet -n "__fish_seen_subcommand_from show" -s h -l help -d 'Print help' complete -c innernet -n "__fish_seen_subcommand_from up" -l interval -d 'Keep fetching the latest peer list at the specified interval in seconds. Valid only in daemon mode' -r -complete -c innernet -n "__fish_seen_subcommand_from up" -l hosts-path -d 'The path to write hosts to' -r +complete -c innernet -n "__fish_seen_subcommand_from up" -l hosts-path -d 'The path to write hosts to' -r -F complete -c innernet -n "__fish_seen_subcommand_from up" -l exclude-nat-candidates -d 'Exclude one or more CIDRs from NAT candidate reporting. ex. --exclude-nat-candidates \'0.0.0.0/0\' would report no candidates' -r complete -c innernet -n "__fish_seen_subcommand_from up" -s d -l daemon -d 'Enable daemon mode i.e. keep the process running, while fetching the latest peer list periodically' complete -c innernet -n "__fish_seen_subcommand_from up" -l no-write-hosts -d 'Don\'t write to any hosts files' complete -c innernet -n "__fish_seen_subcommand_from up" -l no-nat-traversal -d 'Don\'t attempt NAT traversal. Note that this still will report candidates unless you also specify to exclude all NAT candidates' complete -c innernet -n "__fish_seen_subcommand_from up" -l no-nat-candidates -d 'Don\'t report any candidates to coordinating server. Shorthand for --exclude-nat-candidates \'0.0.0.0/0\'' -complete -c innernet -n "__fish_seen_subcommand_from up" -s h -l help -d 'Print help information' -complete -c innernet -n "__fish_seen_subcommand_from fetch" -l hosts-path -d 'The path to write hosts to' -r +complete -c innernet -n "__fish_seen_subcommand_from up" -s h -l help -d 'Print help' +complete -c innernet -n "__fish_seen_subcommand_from fetch" -l hosts-path -d 'The path to write hosts to' -r -F complete -c innernet -n "__fish_seen_subcommand_from fetch" -l exclude-nat-candidates -d 'Exclude one or more CIDRs from NAT candidate reporting. ex. --exclude-nat-candidates \'0.0.0.0/0\' would report no candidates' -r complete -c innernet -n "__fish_seen_subcommand_from fetch" -l no-write-hosts -d 'Don\'t write to any hosts files' complete -c innernet -n "__fish_seen_subcommand_from fetch" -l no-nat-traversal -d 'Don\'t attempt NAT traversal. Note that this still will report candidates unless you also specify to exclude all NAT candidates' complete -c innernet -n "__fish_seen_subcommand_from fetch" -l no-nat-candidates -d 'Don\'t report any candidates to coordinating server. Shorthand for --exclude-nat-candidates \'0.0.0.0/0\'' -complete -c innernet -n "__fish_seen_subcommand_from fetch" -s h -l help -d 'Print help information' +complete -c innernet -n "__fish_seen_subcommand_from fetch" -s h -l help -d 'Print help' complete -c innernet -n "__fish_seen_subcommand_from uninstall" -l yes -d 'Bypass confirmation' -complete -c innernet -n "__fish_seen_subcommand_from uninstall" -s h -l help -d 'Print help information' -complete -c innernet -n "__fish_seen_subcommand_from down" -s h -l help -d 'Print help information' +complete -c innernet -n "__fish_seen_subcommand_from uninstall" -s h -l help -d 'Print help' +complete -c innernet -n "__fish_seen_subcommand_from down" -s h -l help -d 'Print help' complete -c innernet -n "__fish_seen_subcommand_from add-peer" -l name -d 'Name of new peer' -r complete -c innernet -n "__fish_seen_subcommand_from add-peer" -l ip -d 'Specify desired IP of new peer (within parent CIDR)' -r complete -c innernet -n "__fish_seen_subcommand_from add-peer" -l cidr -d 'Name of CIDR to add new peer under' -r -complete -c innernet -n "__fish_seen_subcommand_from add-peer" -l admin -d 'Make new peer an admin?' -r +complete -c innernet -n "__fish_seen_subcommand_from add-peer" -l admin -d 'Make new peer an admin?' -r -f -a "{true ,false }" complete -c innernet -n "__fish_seen_subcommand_from add-peer" -l save-config -d 'Save the config to the given location' -r complete -c innernet -n "__fish_seen_subcommand_from add-peer" -l invite-expires -d 'Invite expiration period (eg. \'30d\', \'7w\', \'2h\', \'60m\', \'1000s\')' -r complete -c innernet -n "__fish_seen_subcommand_from add-peer" -l auto-ip -d 'Auto-assign the peer the first available IP within the CIDR' complete -c innernet -n "__fish_seen_subcommand_from add-peer" -l yes -d 'Bypass confirmation' -complete -c innernet -n "__fish_seen_subcommand_from add-peer" -s h -l help -d 'Print help information' +complete -c innernet -n "__fish_seen_subcommand_from add-peer" -s h -l help -d 'Print help (see more with \'--help\')' complete -c innernet -n "__fish_seen_subcommand_from rename-peer" -l name -d 'Name of peer to rename' -r complete -c innernet -n "__fish_seen_subcommand_from rename-peer" -l new-name -d 'The new name of the peer' -r complete -c innernet -n "__fish_seen_subcommand_from rename-peer" -l yes -d 'Bypass confirmation' -complete -c innernet -n "__fish_seen_subcommand_from rename-peer" -s h -l help -d 'Print help information' +complete -c innernet -n "__fish_seen_subcommand_from rename-peer" -s h -l help -d 'Print help (see more with \'--help\')' complete -c innernet -n "__fish_seen_subcommand_from add-cidr" -l name -d 'The CIDR name (eg. \'engineers\')' -r complete -c innernet -n "__fish_seen_subcommand_from add-cidr" -l cidr -d 'The CIDR network (eg. \'10.42.5.0/24\')' -r complete -c innernet -n "__fish_seen_subcommand_from add-cidr" -l parent -d 'The CIDR parent name' -r complete -c innernet -n "__fish_seen_subcommand_from add-cidr" -l yes -d 'Bypass confirmation' -complete -c innernet -n "__fish_seen_subcommand_from add-cidr" -s h -l help -d 'Print help information' +complete -c innernet -n "__fish_seen_subcommand_from add-cidr" -s h -l help -d 'Print help' complete -c innernet -n "__fish_seen_subcommand_from delete-cidr" -l name -d 'The CIDR name (eg. \'engineers\')' -r complete -c innernet -n "__fish_seen_subcommand_from delete-cidr" -l yes -d 'Bypass confirmation' -complete -c innernet -n "__fish_seen_subcommand_from delete-cidr" -s h -l help -d 'Print help information' +complete -c innernet -n "__fish_seen_subcommand_from delete-cidr" -s h -l help -d 'Print help' complete -c innernet -n "__fish_seen_subcommand_from list-cidrs" -s t -l tree -d 'Display CIDRs in tree format' -complete -c innernet -n "__fish_seen_subcommand_from list-cidrs" -s h -l help -d 'Print help information' -complete -c innernet -n "__fish_seen_subcommand_from disable-peer" -s h -l help -d 'Print help information' -complete -c innernet -n "__fish_seen_subcommand_from enable-peer" -s h -l help -d 'Print help information' +complete -c innernet -n "__fish_seen_subcommand_from list-cidrs" -s h -l help -d 'Print help' +complete -c innernet -n "__fish_seen_subcommand_from disable-peer" -s h -l help -d 'Print help' +complete -c innernet -n "__fish_seen_subcommand_from enable-peer" -s h -l help -d 'Print help' complete -c innernet -n "__fish_seen_subcommand_from add-association" -l yes -d 'Bypass confirmation' -complete -c innernet -n "__fish_seen_subcommand_from add-association" -s h -l help -d 'Print help information' +complete -c innernet -n "__fish_seen_subcommand_from add-association" -s h -l help -d 'Print help' complete -c innernet -n "__fish_seen_subcommand_from delete-association" -l yes -d 'Bypass confirmation' -complete -c innernet -n "__fish_seen_subcommand_from delete-association" -s h -l help -d 'Print help information' -complete -c innernet -n "__fish_seen_subcommand_from list-associations" -s h -l help -d 'Print help information' +complete -c innernet -n "__fish_seen_subcommand_from delete-association" -s h -l help -d 'Print help' +complete -c innernet -n "__fish_seen_subcommand_from list-associations" -s h -l help -d 'Print help' complete -c innernet -n "__fish_seen_subcommand_from set-listen-port" -s l -l listen-port -d 'The listen port you\'d like to set for the interface' -r complete -c innernet -n "__fish_seen_subcommand_from set-listen-port" -s u -l unset -d 'Unset the local listen port to use a randomized port' complete -c innernet -n "__fish_seen_subcommand_from set-listen-port" -l yes -d 'Bypass confirmation' -complete -c innernet -n "__fish_seen_subcommand_from set-listen-port" -s h -l help -d 'Print help information' +complete -c innernet -n "__fish_seen_subcommand_from set-listen-port" -s h -l help -d 'Print help' complete -c innernet -n "__fish_seen_subcommand_from override-endpoint" -s e -l endpoint -d 'The listen port you\'d like to set for the interface' -r complete -c innernet -n "__fish_seen_subcommand_from override-endpoint" -s u -l unset -d 'Unset an existing override to use the automatic endpoint discovery' complete -c innernet -n "__fish_seen_subcommand_from override-endpoint" -l yes -d 'Bypass confirmation' -complete -c innernet -n "__fish_seen_subcommand_from override-endpoint" -s h -l help -d 'Print help information' -complete -c innernet -n "__fish_seen_subcommand_from completions" -s h -l help -d 'Print help information' +complete -c innernet -n "__fish_seen_subcommand_from override-endpoint" -s h -l help -d 'Print help' +complete -c innernet -n "__fish_seen_subcommand_from completions" -s h -l help -d 'Print help' +complete -c innernet -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from show; and not __fish_seen_subcommand_from up; and not __fish_seen_subcommand_from fetch; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from down; and not __fish_seen_subcommand_from add-peer; and not __fish_seen_subcommand_from rename-peer; and not __fish_seen_subcommand_from add-cidr; and not __fish_seen_subcommand_from delete-cidr; and not __fish_seen_subcommand_from list-cidrs; and not __fish_seen_subcommand_from disable-peer; and not __fish_seen_subcommand_from enable-peer; and not __fish_seen_subcommand_from add-association; and not __fish_seen_subcommand_from delete-association; and not __fish_seen_subcommand_from list-associations; and not __fish_seen_subcommand_from set-listen-port; and not __fish_seen_subcommand_from override-endpoint; and not __fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from help" -f -a "install" -d 'Install a new innernet config' +complete -c innernet -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from show; and not __fish_seen_subcommand_from up; and not __fish_seen_subcommand_from fetch; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from down; and not __fish_seen_subcommand_from add-peer; and not __fish_seen_subcommand_from rename-peer; and not __fish_seen_subcommand_from add-cidr; and not __fish_seen_subcommand_from delete-cidr; and not __fish_seen_subcommand_from list-cidrs; and not __fish_seen_subcommand_from disable-peer; and not __fish_seen_subcommand_from enable-peer; and not __fish_seen_subcommand_from add-association; and not __fish_seen_subcommand_from delete-association; and not __fish_seen_subcommand_from list-associations; and not __fish_seen_subcommand_from set-listen-port; and not __fish_seen_subcommand_from override-endpoint; and not __fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from help" -f -a "show" -d 'Enumerate all innernet connections' +complete -c innernet -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from show; and not __fish_seen_subcommand_from up; and not __fish_seen_subcommand_from fetch; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from down; and not __fish_seen_subcommand_from add-peer; and not __fish_seen_subcommand_from rename-peer; and not __fish_seen_subcommand_from add-cidr; and not __fish_seen_subcommand_from delete-cidr; and not __fish_seen_subcommand_from list-cidrs; and not __fish_seen_subcommand_from disable-peer; and not __fish_seen_subcommand_from enable-peer; and not __fish_seen_subcommand_from add-association; and not __fish_seen_subcommand_from delete-association; and not __fish_seen_subcommand_from list-associations; and not __fish_seen_subcommand_from set-listen-port; and not __fish_seen_subcommand_from override-endpoint; and not __fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from help" -f -a "up" -d 'Bring up your local interface, and update it with latest peer list' +complete -c innernet -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from show; and not __fish_seen_subcommand_from up; and not __fish_seen_subcommand_from fetch; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from down; and not __fish_seen_subcommand_from add-peer; and not __fish_seen_subcommand_from rename-peer; and not __fish_seen_subcommand_from add-cidr; and not __fish_seen_subcommand_from delete-cidr; and not __fish_seen_subcommand_from list-cidrs; and not __fish_seen_subcommand_from disable-peer; and not __fish_seen_subcommand_from enable-peer; and not __fish_seen_subcommand_from add-association; and not __fish_seen_subcommand_from delete-association; and not __fish_seen_subcommand_from list-associations; and not __fish_seen_subcommand_from set-listen-port; and not __fish_seen_subcommand_from override-endpoint; and not __fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from help" -f -a "fetch" -d 'Fetch and update your local interface with the latest peer list' +complete -c innernet -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from show; and not __fish_seen_subcommand_from up; and not __fish_seen_subcommand_from fetch; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from down; and not __fish_seen_subcommand_from add-peer; and not __fish_seen_subcommand_from rename-peer; and not __fish_seen_subcommand_from add-cidr; and not __fish_seen_subcommand_from delete-cidr; and not __fish_seen_subcommand_from list-cidrs; and not __fish_seen_subcommand_from disable-peer; and not __fish_seen_subcommand_from enable-peer; and not __fish_seen_subcommand_from add-association; and not __fish_seen_subcommand_from delete-association; and not __fish_seen_subcommand_from list-associations; and not __fish_seen_subcommand_from set-listen-port; and not __fish_seen_subcommand_from override-endpoint; and not __fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from help" -f -a "uninstall" -d 'Uninstall an innernet network' +complete -c innernet -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from show; and not __fish_seen_subcommand_from up; and not __fish_seen_subcommand_from fetch; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from down; and not __fish_seen_subcommand_from add-peer; and not __fish_seen_subcommand_from rename-peer; and not __fish_seen_subcommand_from add-cidr; and not __fish_seen_subcommand_from delete-cidr; and not __fish_seen_subcommand_from list-cidrs; and not __fish_seen_subcommand_from disable-peer; and not __fish_seen_subcommand_from enable-peer; and not __fish_seen_subcommand_from add-association; and not __fish_seen_subcommand_from delete-association; and not __fish_seen_subcommand_from list-associations; and not __fish_seen_subcommand_from set-listen-port; and not __fish_seen_subcommand_from override-endpoint; and not __fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from help" -f -a "down" -d 'Bring down the interface (equivalent to \'wg-quick down \')' +complete -c innernet -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from show; and not __fish_seen_subcommand_from up; and not __fish_seen_subcommand_from fetch; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from down; and not __fish_seen_subcommand_from add-peer; and not __fish_seen_subcommand_from rename-peer; and not __fish_seen_subcommand_from add-cidr; and not __fish_seen_subcommand_from delete-cidr; and not __fish_seen_subcommand_from list-cidrs; and not __fish_seen_subcommand_from disable-peer; and not __fish_seen_subcommand_from enable-peer; and not __fish_seen_subcommand_from add-association; and not __fish_seen_subcommand_from delete-association; and not __fish_seen_subcommand_from list-associations; and not __fish_seen_subcommand_from set-listen-port; and not __fish_seen_subcommand_from override-endpoint; and not __fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from help" -f -a "add-peer" -d 'Add a new peer' +complete -c innernet -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from show; and not __fish_seen_subcommand_from up; and not __fish_seen_subcommand_from fetch; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from down; and not __fish_seen_subcommand_from add-peer; and not __fish_seen_subcommand_from rename-peer; and not __fish_seen_subcommand_from add-cidr; and not __fish_seen_subcommand_from delete-cidr; and not __fish_seen_subcommand_from list-cidrs; and not __fish_seen_subcommand_from disable-peer; and not __fish_seen_subcommand_from enable-peer; and not __fish_seen_subcommand_from add-association; and not __fish_seen_subcommand_from delete-association; and not __fish_seen_subcommand_from list-associations; and not __fish_seen_subcommand_from set-listen-port; and not __fish_seen_subcommand_from override-endpoint; and not __fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from help" -f -a "rename-peer" -d 'Rename a peer' +complete -c innernet -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from show; and not __fish_seen_subcommand_from up; and not __fish_seen_subcommand_from fetch; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from down; and not __fish_seen_subcommand_from add-peer; and not __fish_seen_subcommand_from rename-peer; and not __fish_seen_subcommand_from add-cidr; and not __fish_seen_subcommand_from delete-cidr; and not __fish_seen_subcommand_from list-cidrs; and not __fish_seen_subcommand_from disable-peer; and not __fish_seen_subcommand_from enable-peer; and not __fish_seen_subcommand_from add-association; and not __fish_seen_subcommand_from delete-association; and not __fish_seen_subcommand_from list-associations; and not __fish_seen_subcommand_from set-listen-port; and not __fish_seen_subcommand_from override-endpoint; and not __fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from help" -f -a "add-cidr" -d 'Add a new CIDR' +complete -c innernet -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from show; and not __fish_seen_subcommand_from up; and not __fish_seen_subcommand_from fetch; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from down; and not __fish_seen_subcommand_from add-peer; and not __fish_seen_subcommand_from rename-peer; and not __fish_seen_subcommand_from add-cidr; and not __fish_seen_subcommand_from delete-cidr; and not __fish_seen_subcommand_from list-cidrs; and not __fish_seen_subcommand_from disable-peer; and not __fish_seen_subcommand_from enable-peer; and not __fish_seen_subcommand_from add-association; and not __fish_seen_subcommand_from delete-association; and not __fish_seen_subcommand_from list-associations; and not __fish_seen_subcommand_from set-listen-port; and not __fish_seen_subcommand_from override-endpoint; and not __fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from help" -f -a "delete-cidr" -d 'Delete a CIDR' +complete -c innernet -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from show; and not __fish_seen_subcommand_from up; and not __fish_seen_subcommand_from fetch; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from down; and not __fish_seen_subcommand_from add-peer; and not __fish_seen_subcommand_from rename-peer; and not __fish_seen_subcommand_from add-cidr; and not __fish_seen_subcommand_from delete-cidr; and not __fish_seen_subcommand_from list-cidrs; and not __fish_seen_subcommand_from disable-peer; and not __fish_seen_subcommand_from enable-peer; and not __fish_seen_subcommand_from add-association; and not __fish_seen_subcommand_from delete-association; and not __fish_seen_subcommand_from list-associations; and not __fish_seen_subcommand_from set-listen-port; and not __fish_seen_subcommand_from override-endpoint; and not __fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from help" -f -a "list-cidrs" -d 'List CIDRs' +complete -c innernet -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from show; and not __fish_seen_subcommand_from up; and not __fish_seen_subcommand_from fetch; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from down; and not __fish_seen_subcommand_from add-peer; and not __fish_seen_subcommand_from rename-peer; and not __fish_seen_subcommand_from add-cidr; and not __fish_seen_subcommand_from delete-cidr; and not __fish_seen_subcommand_from list-cidrs; and not __fish_seen_subcommand_from disable-peer; and not __fish_seen_subcommand_from enable-peer; and not __fish_seen_subcommand_from add-association; and not __fish_seen_subcommand_from delete-association; and not __fish_seen_subcommand_from list-associations; and not __fish_seen_subcommand_from set-listen-port; and not __fish_seen_subcommand_from override-endpoint; and not __fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from help" -f -a "disable-peer" -d 'Disable an enabled peer' +complete -c innernet -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from show; and not __fish_seen_subcommand_from up; and not __fish_seen_subcommand_from fetch; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from down; and not __fish_seen_subcommand_from add-peer; and not __fish_seen_subcommand_from rename-peer; and not __fish_seen_subcommand_from add-cidr; and not __fish_seen_subcommand_from delete-cidr; and not __fish_seen_subcommand_from list-cidrs; and not __fish_seen_subcommand_from disable-peer; and not __fish_seen_subcommand_from enable-peer; and not __fish_seen_subcommand_from add-association; and not __fish_seen_subcommand_from delete-association; and not __fish_seen_subcommand_from list-associations; and not __fish_seen_subcommand_from set-listen-port; and not __fish_seen_subcommand_from override-endpoint; and not __fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from help" -f -a "enable-peer" -d 'Enable a disabled peer' +complete -c innernet -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from show; and not __fish_seen_subcommand_from up; and not __fish_seen_subcommand_from fetch; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from down; and not __fish_seen_subcommand_from add-peer; and not __fish_seen_subcommand_from rename-peer; and not __fish_seen_subcommand_from add-cidr; and not __fish_seen_subcommand_from delete-cidr; and not __fish_seen_subcommand_from list-cidrs; and not __fish_seen_subcommand_from disable-peer; and not __fish_seen_subcommand_from enable-peer; and not __fish_seen_subcommand_from add-association; and not __fish_seen_subcommand_from delete-association; and not __fish_seen_subcommand_from list-associations; and not __fish_seen_subcommand_from set-listen-port; and not __fish_seen_subcommand_from override-endpoint; and not __fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from help" -f -a "add-association" -d 'Add an association between CIDRs' +complete -c innernet -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from show; and not __fish_seen_subcommand_from up; and not __fish_seen_subcommand_from fetch; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from down; and not __fish_seen_subcommand_from add-peer; and not __fish_seen_subcommand_from rename-peer; and not __fish_seen_subcommand_from add-cidr; and not __fish_seen_subcommand_from delete-cidr; and not __fish_seen_subcommand_from list-cidrs; and not __fish_seen_subcommand_from disable-peer; and not __fish_seen_subcommand_from enable-peer; and not __fish_seen_subcommand_from add-association; and not __fish_seen_subcommand_from delete-association; and not __fish_seen_subcommand_from list-associations; and not __fish_seen_subcommand_from set-listen-port; and not __fish_seen_subcommand_from override-endpoint; and not __fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from help" -f -a "delete-association" -d 'Delete an association between CIDRs' +complete -c innernet -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from show; and not __fish_seen_subcommand_from up; and not __fish_seen_subcommand_from fetch; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from down; and not __fish_seen_subcommand_from add-peer; and not __fish_seen_subcommand_from rename-peer; and not __fish_seen_subcommand_from add-cidr; and not __fish_seen_subcommand_from delete-cidr; and not __fish_seen_subcommand_from list-cidrs; and not __fish_seen_subcommand_from disable-peer; and not __fish_seen_subcommand_from enable-peer; and not __fish_seen_subcommand_from add-association; and not __fish_seen_subcommand_from delete-association; and not __fish_seen_subcommand_from list-associations; and not __fish_seen_subcommand_from set-listen-port; and not __fish_seen_subcommand_from override-endpoint; and not __fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from help" -f -a "list-associations" -d 'List existing assocations between CIDRs' +complete -c innernet -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from show; and not __fish_seen_subcommand_from up; and not __fish_seen_subcommand_from fetch; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from down; and not __fish_seen_subcommand_from add-peer; and not __fish_seen_subcommand_from rename-peer; and not __fish_seen_subcommand_from add-cidr; and not __fish_seen_subcommand_from delete-cidr; and not __fish_seen_subcommand_from list-cidrs; and not __fish_seen_subcommand_from disable-peer; and not __fish_seen_subcommand_from enable-peer; and not __fish_seen_subcommand_from add-association; and not __fish_seen_subcommand_from delete-association; and not __fish_seen_subcommand_from list-associations; and not __fish_seen_subcommand_from set-listen-port; and not __fish_seen_subcommand_from override-endpoint; and not __fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from help" -f -a "set-listen-port" -d 'Set the local listen port' +complete -c innernet -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from show; and not __fish_seen_subcommand_from up; and not __fish_seen_subcommand_from fetch; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from down; and not __fish_seen_subcommand_from add-peer; and not __fish_seen_subcommand_from rename-peer; and not __fish_seen_subcommand_from add-cidr; and not __fish_seen_subcommand_from delete-cidr; and not __fish_seen_subcommand_from list-cidrs; and not __fish_seen_subcommand_from disable-peer; and not __fish_seen_subcommand_from enable-peer; and not __fish_seen_subcommand_from add-association; and not __fish_seen_subcommand_from delete-association; and not __fish_seen_subcommand_from list-associations; and not __fish_seen_subcommand_from set-listen-port; and not __fish_seen_subcommand_from override-endpoint; and not __fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from help" -f -a "override-endpoint" -d 'Override your external endpoint that the server sends to other peers' +complete -c innernet -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from show; and not __fish_seen_subcommand_from up; and not __fish_seen_subcommand_from fetch; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from down; and not __fish_seen_subcommand_from add-peer; and not __fish_seen_subcommand_from rename-peer; and not __fish_seen_subcommand_from add-cidr; and not __fish_seen_subcommand_from delete-cidr; and not __fish_seen_subcommand_from list-cidrs; and not __fish_seen_subcommand_from disable-peer; and not __fish_seen_subcommand_from enable-peer; and not __fish_seen_subcommand_from add-association; and not __fish_seen_subcommand_from delete-association; and not __fish_seen_subcommand_from list-associations; and not __fish_seen_subcommand_from set-listen-port; and not __fish_seen_subcommand_from override-endpoint; and not __fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from help" -f -a "completions" -d 'Generate shell completion scripts' +complete -c innernet -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from show; and not __fish_seen_subcommand_from up; and not __fish_seen_subcommand_from fetch; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from down; and not __fish_seen_subcommand_from add-peer; and not __fish_seen_subcommand_from rename-peer; and not __fish_seen_subcommand_from add-cidr; and not __fish_seen_subcommand_from delete-cidr; and not __fish_seen_subcommand_from list-cidrs; and not __fish_seen_subcommand_from disable-peer; and not __fish_seen_subcommand_from enable-peer; and not __fish_seen_subcommand_from add-association; and not __fish_seen_subcommand_from delete-association; and not __fish_seen_subcommand_from list-associations; and not __fish_seen_subcommand_from set-listen-port; and not __fish_seen_subcommand_from override-endpoint; and not __fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' diff --git a/doc/innernet.completions.powershell b/doc/innernet.completions.powershell index c6e2de71..d8a65068 100644 --- a/doc/innernet.completions.powershell +++ b/doc/innernet.completions.powershell @@ -27,13 +27,13 @@ Register-ArgumentCompleter -Native -CommandName 'innernet' -ScriptBlock { [CompletionResult]::new('--data-dir', 'data-dir', [CompletionResultType]::ParameterName, 'data-dir') [CompletionResult]::new('--backend', 'backend', [CompletionResultType]::ParameterName, 'Specify a WireGuard backend to use. If not set, innernet will auto-select based on availability') [CompletionResult]::new('--mtu', 'mtu', [CompletionResultType]::ParameterName, 'Specify the desired MTU for your interface (default: 1280)') - [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help information') - [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help information') - [CompletionResult]::new('-V', 'V', [CompletionResultType]::ParameterName, 'Print version information') - [CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Print version information') [CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'Verbose output, use -vv for even higher verbositude') [CompletionResult]::new('--verbose', 'verbose', [CompletionResultType]::ParameterName, 'Verbose output, use -vv for even higher verbositude') [CompletionResult]::new('--no-routing', 'no-routing', [CompletionResultType]::ParameterName, 'Whether the routing should be done by innernet or is done by an external tool like e.g. babeld') + [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help') + [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help') + [CompletionResult]::new('-V', 'V', [CompletionResultType]::ParameterName, 'Print version') + [CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Print version') [CompletionResult]::new('install', 'install', [CompletionResultType]::ParameterValue, 'Install a new innernet config') [CompletionResult]::new('show', 'show', [CompletionResultType]::ParameterValue, 'Enumerate all innernet connections') [CompletionResult]::new('up', 'up', [CompletionResultType]::ParameterValue, 'Bring up your local interface, and update it with latest peer list') @@ -66,8 +66,8 @@ Register-ArgumentCompleter -Native -CommandName 'innernet' -ScriptBlock { [CompletionResult]::new('--delete-invite', 'delete-invite', [CompletionResultType]::ParameterName, 'Delete the invitation after a successful install') [CompletionResult]::new('--no-nat-traversal', 'no-nat-traversal', [CompletionResultType]::ParameterName, 'Don''t attempt NAT traversal. Note that this still will report candidates unless you also specify to exclude all NAT candidates') [CompletionResult]::new('--no-nat-candidates', 'no-nat-candidates', [CompletionResultType]::ParameterName, 'Don''t report any candidates to coordinating server. Shorthand for --exclude-nat-candidates ''0.0.0.0/0''') - [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help information') - [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help information') + [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help') + [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help') break } 'innernet;show' { @@ -75,8 +75,8 @@ Register-ArgumentCompleter -Native -CommandName 'innernet' -ScriptBlock { [CompletionResult]::new('--short', 'short', [CompletionResultType]::ParameterName, 'One-line peer list') [CompletionResult]::new('-t', 't', [CompletionResultType]::ParameterName, 'Display peers in a tree based on the CIDRs') [CompletionResult]::new('--tree', 'tree', [CompletionResultType]::ParameterName, 'Display peers in a tree based on the CIDRs') - [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help information') - [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help information') + [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help') + [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help') break } 'innernet;up' { @@ -88,8 +88,8 @@ Register-ArgumentCompleter -Native -CommandName 'innernet' -ScriptBlock { [CompletionResult]::new('--no-write-hosts', 'no-write-hosts', [CompletionResultType]::ParameterName, 'Don''t write to any hosts files') [CompletionResult]::new('--no-nat-traversal', 'no-nat-traversal', [CompletionResultType]::ParameterName, 'Don''t attempt NAT traversal. Note that this still will report candidates unless you also specify to exclude all NAT candidates') [CompletionResult]::new('--no-nat-candidates', 'no-nat-candidates', [CompletionResultType]::ParameterName, 'Don''t report any candidates to coordinating server. Shorthand for --exclude-nat-candidates ''0.0.0.0/0''') - [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help information') - [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help information') + [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help') + [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help') break } 'innernet;fetch' { @@ -98,19 +98,19 @@ Register-ArgumentCompleter -Native -CommandName 'innernet' -ScriptBlock { [CompletionResult]::new('--no-write-hosts', 'no-write-hosts', [CompletionResultType]::ParameterName, 'Don''t write to any hosts files') [CompletionResult]::new('--no-nat-traversal', 'no-nat-traversal', [CompletionResultType]::ParameterName, 'Don''t attempt NAT traversal. Note that this still will report candidates unless you also specify to exclude all NAT candidates') [CompletionResult]::new('--no-nat-candidates', 'no-nat-candidates', [CompletionResultType]::ParameterName, 'Don''t report any candidates to coordinating server. Shorthand for --exclude-nat-candidates ''0.0.0.0/0''') - [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help information') - [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help information') + [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help') + [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help') break } 'innernet;uninstall' { [CompletionResult]::new('--yes', 'yes', [CompletionResultType]::ParameterName, 'Bypass confirmation') - [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help information') - [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help information') + [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help') + [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help') break } 'innernet;down' { - [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help information') - [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help information') + [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help') + [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help') break } 'innernet;add-peer' { @@ -122,16 +122,16 @@ Register-ArgumentCompleter -Native -CommandName 'innernet' -ScriptBlock { [CompletionResult]::new('--invite-expires', 'invite-expires', [CompletionResultType]::ParameterName, 'Invite expiration period (eg. ''30d'', ''7w'', ''2h'', ''60m'', ''1000s'')') [CompletionResult]::new('--auto-ip', 'auto-ip', [CompletionResultType]::ParameterName, 'Auto-assign the peer the first available IP within the CIDR') [CompletionResult]::new('--yes', 'yes', [CompletionResultType]::ParameterName, 'Bypass confirmation') - [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help information') - [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help information') + [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help (see more with ''--help'')') + [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help (see more with ''--help'')') break } 'innernet;rename-peer' { [CompletionResult]::new('--name', 'name', [CompletionResultType]::ParameterName, 'Name of peer to rename') [CompletionResult]::new('--new-name', 'new-name', [CompletionResultType]::ParameterName, 'The new name of the peer') [CompletionResult]::new('--yes', 'yes', [CompletionResultType]::ParameterName, 'Bypass confirmation') - [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help information') - [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help information') + [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help (see more with ''--help'')') + [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help (see more with ''--help'')') break } 'innernet;add-cidr' { @@ -139,49 +139,49 @@ Register-ArgumentCompleter -Native -CommandName 'innernet' -ScriptBlock { [CompletionResult]::new('--cidr', 'cidr', [CompletionResultType]::ParameterName, 'The CIDR network (eg. ''10.42.5.0/24'')') [CompletionResult]::new('--parent', 'parent', [CompletionResultType]::ParameterName, 'The CIDR parent name') [CompletionResult]::new('--yes', 'yes', [CompletionResultType]::ParameterName, 'Bypass confirmation') - [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help information') - [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help information') + [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help') + [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help') break } 'innernet;delete-cidr' { [CompletionResult]::new('--name', 'name', [CompletionResultType]::ParameterName, 'The CIDR name (eg. ''engineers'')') [CompletionResult]::new('--yes', 'yes', [CompletionResultType]::ParameterName, 'Bypass confirmation') - [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help information') - [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help information') + [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help') + [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help') break } 'innernet;list-cidrs' { [CompletionResult]::new('-t', 't', [CompletionResultType]::ParameterName, 'Display CIDRs in tree format') [CompletionResult]::new('--tree', 'tree', [CompletionResultType]::ParameterName, 'Display CIDRs in tree format') - [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help information') - [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help information') + [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help') + [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help') break } 'innernet;disable-peer' { - [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help information') - [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help information') + [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help') + [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help') break } 'innernet;enable-peer' { - [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help information') - [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help information') + [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help') + [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help') break } 'innernet;add-association' { [CompletionResult]::new('--yes', 'yes', [CompletionResultType]::ParameterName, 'Bypass confirmation') - [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help information') - [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help information') + [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help') + [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help') break } 'innernet;delete-association' { [CompletionResult]::new('--yes', 'yes', [CompletionResultType]::ParameterName, 'Bypass confirmation') - [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help information') - [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help information') + [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help') + [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help') break } 'innernet;list-associations' { - [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help information') - [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help information') + [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help') + [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help') break } 'innernet;set-listen-port' { @@ -190,8 +190,8 @@ Register-ArgumentCompleter -Native -CommandName 'innernet' -ScriptBlock { [CompletionResult]::new('-u', 'u', [CompletionResultType]::ParameterName, 'Unset the local listen port to use a randomized port') [CompletionResult]::new('--unset', 'unset', [CompletionResultType]::ParameterName, 'Unset the local listen port to use a randomized port') [CompletionResult]::new('--yes', 'yes', [CompletionResultType]::ParameterName, 'Bypass confirmation') - [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help information') - [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help information') + [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help') + [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help') break } 'innernet;override-endpoint' { @@ -200,16 +200,96 @@ Register-ArgumentCompleter -Native -CommandName 'innernet' -ScriptBlock { [CompletionResult]::new('-u', 'u', [CompletionResultType]::ParameterName, 'Unset an existing override to use the automatic endpoint discovery') [CompletionResult]::new('--unset', 'unset', [CompletionResultType]::ParameterName, 'Unset an existing override to use the automatic endpoint discovery') [CompletionResult]::new('--yes', 'yes', [CompletionResultType]::ParameterName, 'Bypass confirmation') - [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help information') - [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help information') + [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help') + [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help') break } 'innernet;completions' { - [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help information') - [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help information') + [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help') + [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help') break } 'innernet;help' { + [CompletionResult]::new('install', 'install', [CompletionResultType]::ParameterValue, 'Install a new innernet config') + [CompletionResult]::new('show', 'show', [CompletionResultType]::ParameterValue, 'Enumerate all innernet connections') + [CompletionResult]::new('up', 'up', [CompletionResultType]::ParameterValue, 'Bring up your local interface, and update it with latest peer list') + [CompletionResult]::new('fetch', 'fetch', [CompletionResultType]::ParameterValue, 'Fetch and update your local interface with the latest peer list') + [CompletionResult]::new('uninstall', 'uninstall', [CompletionResultType]::ParameterValue, 'Uninstall an innernet network') + [CompletionResult]::new('down', 'down', [CompletionResultType]::ParameterValue, 'Bring down the interface (equivalent to ''wg-quick down '')') + [CompletionResult]::new('add-peer', 'add-peer', [CompletionResultType]::ParameterValue, 'Add a new peer') + [CompletionResult]::new('rename-peer', 'rename-peer', [CompletionResultType]::ParameterValue, 'Rename a peer') + [CompletionResult]::new('add-cidr', 'add-cidr', [CompletionResultType]::ParameterValue, 'Add a new CIDR') + [CompletionResult]::new('delete-cidr', 'delete-cidr', [CompletionResultType]::ParameterValue, 'Delete a CIDR') + [CompletionResult]::new('list-cidrs', 'list-cidrs', [CompletionResultType]::ParameterValue, 'List CIDRs') + [CompletionResult]::new('disable-peer', 'disable-peer', [CompletionResultType]::ParameterValue, 'Disable an enabled peer') + [CompletionResult]::new('enable-peer', 'enable-peer', [CompletionResultType]::ParameterValue, 'Enable a disabled peer') + [CompletionResult]::new('add-association', 'add-association', [CompletionResultType]::ParameterValue, 'Add an association between CIDRs') + [CompletionResult]::new('delete-association', 'delete-association', [CompletionResultType]::ParameterValue, 'Delete an association between CIDRs') + [CompletionResult]::new('list-associations', 'list-associations', [CompletionResultType]::ParameterValue, 'List existing assocations between CIDRs') + [CompletionResult]::new('set-listen-port', 'set-listen-port', [CompletionResultType]::ParameterValue, 'Set the local listen port') + [CompletionResult]::new('override-endpoint', 'override-endpoint', [CompletionResultType]::ParameterValue, 'Override your external endpoint that the server sends to other peers') + [CompletionResult]::new('completions', 'completions', [CompletionResultType]::ParameterValue, 'Generate shell completion scripts') + [CompletionResult]::new('help', 'help', [CompletionResultType]::ParameterValue, 'Print this message or the help of the given subcommand(s)') + break + } + 'innernet;help;install' { + break + } + 'innernet;help;show' { + break + } + 'innernet;help;up' { + break + } + 'innernet;help;fetch' { + break + } + 'innernet;help;uninstall' { + break + } + 'innernet;help;down' { + break + } + 'innernet;help;add-peer' { + break + } + 'innernet;help;rename-peer' { + break + } + 'innernet;help;add-cidr' { + break + } + 'innernet;help;delete-cidr' { + break + } + 'innernet;help;list-cidrs' { + break + } + 'innernet;help;disable-peer' { + break + } + 'innernet;help;enable-peer' { + break + } + 'innernet;help;add-association' { + break + } + 'innernet;help;delete-association' { + break + } + 'innernet;help;list-associations' { + break + } + 'innernet;help;set-listen-port' { + break + } + 'innernet;help;override-endpoint' { + break + } + 'innernet;help;completions' { + break + } + 'innernet;help;help' { break } }) diff --git a/doc/innernet.completions.zsh b/doc/innernet.completions.zsh index 81a3c0d6..44560434 100644 --- a/doc/innernet.completions.zsh +++ b/doc/innernet.completions.zsh @@ -15,19 +15,19 @@ _innernet() { local context curcontext="$curcontext" state line _arguments "${_arguments_options[@]}" \ -'-c+[]:CONFIG_DIR: ' \ -'--config-dir=[]:CONFIG_DIR: ' \ -'-d+[]:DATA_DIR: ' \ -'--data-dir=[]:DATA_DIR: ' \ +'-c+[]:CONFIG_DIR:_files' \ +'--config-dir=[]:CONFIG_DIR:_files' \ +'-d+[]:DATA_DIR:_files' \ +'--data-dir=[]:DATA_DIR:_files' \ '--backend=[Specify a WireGuard backend to use. If not set, innernet will auto-select based on availability]:BACKEND:(kernel userspace)' \ -'--mtu=[Specify the desired MTU for your interface (default: 1280)]:MTU: ' \ -'-h[Print help information]' \ -'--help[Print help information]' \ -'-V[Print version information]' \ -'--version[Print version information]' \ +'--mtu=[Specify the desired MTU for your interface (default\: 1280)]:MTU: ' \ '*-v[Verbose output, use -vv for even higher verbositude]' \ '*--verbose[Verbose output, use -vv for even higher verbositude]' \ '--no-routing[Whether the routing should be done by innernet or is done by an external tool like e.g. babeld]' \ +'-h[Print help]' \ +'--help[Print help]' \ +'-V[Print version]' \ +'--version[Print version]' \ ":: :_innernet_commands" \ "*::: :->innernet" \ && ret=0 @@ -39,7 +39,7 @@ _innernet() { case $line[1] in (install) _arguments "${_arguments_options[@]}" \ -'--hosts-path=[The path to write hosts to]:HOSTS_PATH: ' \ +'--hosts-path=[The path to write hosts to]:HOSTS_PATH:_files' \ '(--default-name)--name=[Set a specific interface name]:NAME: ' \ '*--exclude-nat-candidates=[Exclude one or more CIDRs from NAT candidate reporting. ex. --exclude-nat-candidates '\''0.0.0.0/0'\'' would report no candidates]:EXCLUDE_NAT_CANDIDATES: ' \ '(--hosts-path)--no-write-hosts[Don'\''t write to any hosts files]' \ @@ -48,9 +48,9 @@ _arguments "${_arguments_options[@]}" \ '--delete-invite[Delete the invitation after a successful install]' \ '--no-nat-traversal[Don'\''t attempt NAT traversal. Note that this still will report candidates unless you also specify to exclude all NAT candidates]' \ '(--exclude-nat-candidates)--no-nat-candidates[Don'\''t report any candidates to coordinating server. Shorthand for --exclude-nat-candidates '\''0.0.0.0/0'\'']' \ -'-h[Print help information]' \ -'--help[Print help information]' \ -':invite -- Path to the invitation file:' \ +'-h[Print help]' \ +'--help[Print help]' \ +':invite -- Path to the invitation file:_files' \ && ret=0 ;; (show) @@ -59,50 +59,50 @@ _arguments "${_arguments_options[@]}" \ '--short[One-line peer list]' \ '-t[Display peers in a tree based on the CIDRs]' \ '--tree[Display peers in a tree based on the CIDRs]' \ -'-h[Print help information]' \ -'--help[Print help information]' \ +'-h[Print help]' \ +'--help[Print help]' \ '::interface:' \ && ret=0 ;; (up) _arguments "${_arguments_options[@]}" \ '--interval=[Keep fetching the latest peer list at the specified interval in seconds. Valid only in daemon mode]:INTERVAL: ' \ -'--hosts-path=[The path to write hosts to]:HOSTS_PATH: ' \ +'--hosts-path=[The path to write hosts to]:HOSTS_PATH:_files' \ '*--exclude-nat-candidates=[Exclude one or more CIDRs from NAT candidate reporting. ex. --exclude-nat-candidates '\''0.0.0.0/0'\'' would report no candidates]:EXCLUDE_NAT_CANDIDATES: ' \ '-d[Enable daemon mode i.e. keep the process running, while fetching the latest peer list periodically]' \ '--daemon[Enable daemon mode i.e. keep the process running, while fetching the latest peer list periodically]' \ '(--hosts-path)--no-write-hosts[Don'\''t write to any hosts files]' \ '--no-nat-traversal[Don'\''t attempt NAT traversal. Note that this still will report candidates unless you also specify to exclude all NAT candidates]' \ '(--exclude-nat-candidates)--no-nat-candidates[Don'\''t report any candidates to coordinating server. Shorthand for --exclude-nat-candidates '\''0.0.0.0/0'\'']' \ -'-h[Print help information]' \ -'--help[Print help information]' \ +'-h[Print help]' \ +'--help[Print help]' \ '::interface:' \ && ret=0 ;; (fetch) _arguments "${_arguments_options[@]}" \ -'--hosts-path=[The path to write hosts to]:HOSTS_PATH: ' \ +'--hosts-path=[The path to write hosts to]:HOSTS_PATH:_files' \ '*--exclude-nat-candidates=[Exclude one or more CIDRs from NAT candidate reporting. ex. --exclude-nat-candidates '\''0.0.0.0/0'\'' would report no candidates]:EXCLUDE_NAT_CANDIDATES: ' \ '(--hosts-path)--no-write-hosts[Don'\''t write to any hosts files]' \ '--no-nat-traversal[Don'\''t attempt NAT traversal. Note that this still will report candidates unless you also specify to exclude all NAT candidates]' \ '(--exclude-nat-candidates)--no-nat-candidates[Don'\''t report any candidates to coordinating server. Shorthand for --exclude-nat-candidates '\''0.0.0.0/0'\'']' \ -'-h[Print help information]' \ -'--help[Print help information]' \ +'-h[Print help]' \ +'--help[Print help]' \ ':interface:' \ && ret=0 ;; (uninstall) _arguments "${_arguments_options[@]}" \ '--yes[Bypass confirmation]' \ -'-h[Print help information]' \ -'--help[Print help information]' \ +'-h[Print help]' \ +'--help[Print help]' \ ':interface:' \ && ret=0 ;; (down) _arguments "${_arguments_options[@]}" \ -'-h[Print help information]' \ -'--help[Print help information]' \ +'-h[Print help]' \ +'--help[Print help]' \ ':interface:' \ && ret=0 ;; @@ -111,13 +111,13 @@ _arguments "${_arguments_options[@]}" \ '--name=[Name of new peer]:NAME: ' \ '(--auto-ip)--ip=[Specify desired IP of new peer (within parent CIDR)]:IP: ' \ '--cidr=[Name of CIDR to add new peer under]:CIDR: ' \ -'--admin=[Make new peer an admin?]:ADMIN: ' \ +'--admin=[Make new peer an admin?]:ADMIN:(true false)' \ '--save-config=[Save the config to the given location]:SAVE_CONFIG: ' \ '--invite-expires=[Invite expiration period (eg. '\''30d'\'', '\''7w'\'', '\''2h'\'', '\''60m'\'', '\''1000s'\'')]:INVITE_EXPIRES: ' \ '--auto-ip[Auto-assign the peer the first available IP within the CIDR]' \ '--yes[Bypass confirmation]' \ -'-h[Print help information]' \ -'--help[Print help information]' \ +'-h[Print help (see more with '\''--help'\'')]' \ +'--help[Print help (see more with '\''--help'\'')]' \ ':interface:' \ && ret=0 ;; @@ -126,8 +126,8 @@ _arguments "${_arguments_options[@]}" \ '--name=[Name of peer to rename]:NAME: ' \ '--new-name=[The new name of the peer]:NEW_NAME: ' \ '--yes[Bypass confirmation]' \ -'-h[Print help information]' \ -'--help[Print help information]' \ +'-h[Print help (see more with '\''--help'\'')]' \ +'--help[Print help (see more with '\''--help'\'')]' \ ':interface:' \ && ret=0 ;; @@ -137,8 +137,8 @@ _arguments "${_arguments_options[@]}" \ '--cidr=[The CIDR network (eg. '\''10.42.5.0/24'\'')]:CIDR: ' \ '--parent=[The CIDR parent name]:PARENT: ' \ '--yes[Bypass confirmation]' \ -'-h[Print help information]' \ -'--help[Print help information]' \ +'-h[Print help]' \ +'--help[Print help]' \ ':interface:' \ && ret=0 ;; @@ -146,8 +146,8 @@ _arguments "${_arguments_options[@]}" \ _arguments "${_arguments_options[@]}" \ '--name=[The CIDR name (eg. '\''engineers'\'')]:NAME: ' \ '--yes[Bypass confirmation]' \ -'-h[Print help information]' \ -'--help[Print help information]' \ +'-h[Print help]' \ +'--help[Print help]' \ ':interface:' \ && ret=0 ;; @@ -155,30 +155,30 @@ _arguments "${_arguments_options[@]}" \ _arguments "${_arguments_options[@]}" \ '-t[Display CIDRs in tree format]' \ '--tree[Display CIDRs in tree format]' \ -'-h[Print help information]' \ -'--help[Print help information]' \ +'-h[Print help]' \ +'--help[Print help]' \ ':interface:' \ && ret=0 ;; (disable-peer) _arguments "${_arguments_options[@]}" \ -'-h[Print help information]' \ -'--help[Print help information]' \ +'-h[Print help]' \ +'--help[Print help]' \ ':interface:' \ && ret=0 ;; (enable-peer) _arguments "${_arguments_options[@]}" \ -'-h[Print help information]' \ -'--help[Print help information]' \ +'-h[Print help]' \ +'--help[Print help]' \ ':interface:' \ && ret=0 ;; (add-association) _arguments "${_arguments_options[@]}" \ '--yes[Bypass confirmation]' \ -'-h[Print help information]' \ -'--help[Print help information]' \ +'-h[Print help]' \ +'--help[Print help]' \ ':interface:' \ '::cidr1 -- The first cidr to associate:' \ '::cidr2 -- The second cidr to associate:' \ @@ -187,8 +187,8 @@ _arguments "${_arguments_options[@]}" \ (delete-association) _arguments "${_arguments_options[@]}" \ '--yes[Bypass confirmation]' \ -'-h[Print help information]' \ -'--help[Print help information]' \ +'-h[Print help]' \ +'--help[Print help]' \ ':interface:' \ '::cidr1 -- The first cidr to associate:' \ '::cidr2 -- The second cidr to associate:' \ @@ -196,8 +196,8 @@ _arguments "${_arguments_options[@]}" \ ;; (list-associations) _arguments "${_arguments_options[@]}" \ -'-h[Print help information]' \ -'--help[Print help information]' \ +'-h[Print help]' \ +'--help[Print help]' \ ':interface:' \ && ret=0 ;; @@ -208,8 +208,8 @@ _arguments "${_arguments_options[@]}" \ '(-l --listen-port)-u[Unset the local listen port to use a randomized port]' \ '(-l --listen-port)--unset[Unset the local listen port to use a randomized port]' \ '--yes[Bypass confirmation]' \ -'-h[Print help information]' \ -'--help[Print help information]' \ +'-h[Print help]' \ +'--help[Print help]' \ ':interface:' \ && ret=0 ;; @@ -220,26 +220,117 @@ _arguments "${_arguments_options[@]}" \ '(-e --endpoint)-u[Unset an existing override to use the automatic endpoint discovery]' \ '(-e --endpoint)--unset[Unset an existing override to use the automatic endpoint discovery]' \ '--yes[Bypass confirmation]' \ -'-h[Print help information]' \ -'--help[Print help information]' \ +'-h[Print help]' \ +'--help[Print help]' \ ':interface:' \ && ret=0 ;; (completions) _arguments "${_arguments_options[@]}" \ -'-h[Print help information]' \ -'--help[Print help information]' \ +'-h[Print help]' \ +'--help[Print help]' \ ':shell:(bash elvish fish powershell zsh)' \ && ret=0 ;; (help) _arguments "${_arguments_options[@]}" \ -'*::subcommand -- The subcommand whose help message to display:' \ +":: :_innernet__help_commands" \ +"*::: :->help" \ +&& ret=0 + + case $state in + (help) + words=($line[1] "${words[@]}") + (( CURRENT += 1 )) + curcontext="${curcontext%:*:*}:innernet-help-command-$line[1]:" + case $line[1] in + (install) +_arguments "${_arguments_options[@]}" \ +&& ret=0 +;; +(show) +_arguments "${_arguments_options[@]}" \ +&& ret=0 +;; +(up) +_arguments "${_arguments_options[@]}" \ +&& ret=0 +;; +(fetch) +_arguments "${_arguments_options[@]}" \ +&& ret=0 +;; +(uninstall) +_arguments "${_arguments_options[@]}" \ +&& ret=0 +;; +(down) +_arguments "${_arguments_options[@]}" \ +&& ret=0 +;; +(add-peer) +_arguments "${_arguments_options[@]}" \ +&& ret=0 +;; +(rename-peer) +_arguments "${_arguments_options[@]}" \ +&& ret=0 +;; +(add-cidr) +_arguments "${_arguments_options[@]}" \ +&& ret=0 +;; +(delete-cidr) +_arguments "${_arguments_options[@]}" \ +&& ret=0 +;; +(list-cidrs) +_arguments "${_arguments_options[@]}" \ +&& ret=0 +;; +(disable-peer) +_arguments "${_arguments_options[@]}" \ +&& ret=0 +;; +(enable-peer) +_arguments "${_arguments_options[@]}" \ +&& ret=0 +;; +(add-association) +_arguments "${_arguments_options[@]}" \ +&& ret=0 +;; +(delete-association) +_arguments "${_arguments_options[@]}" \ +&& ret=0 +;; +(list-associations) +_arguments "${_arguments_options[@]}" \ +&& ret=0 +;; +(set-listen-port) +_arguments "${_arguments_options[@]}" \ +&& ret=0 +;; +(override-endpoint) +_arguments "${_arguments_options[@]}" \ +&& ret=0 +;; +(completions) +_arguments "${_arguments_options[@]}" \ +&& ret=0 +;; +(help) +_arguments "${_arguments_options[@]}" \ && ret=0 ;; esac ;; esac +;; + esac + ;; +esac } (( $+functions[_innernet_commands] )) || @@ -273,100 +364,225 @@ _innernet__add-association_commands() { local commands; commands=() _describe -t commands 'innernet add-association commands' commands "$@" } +(( $+functions[_innernet__help__add-association_commands] )) || +_innernet__help__add-association_commands() { + local commands; commands=() + _describe -t commands 'innernet help add-association commands' commands "$@" +} (( $+functions[_innernet__add-cidr_commands] )) || _innernet__add-cidr_commands() { local commands; commands=() _describe -t commands 'innernet add-cidr commands' commands "$@" } +(( $+functions[_innernet__help__add-cidr_commands] )) || +_innernet__help__add-cidr_commands() { + local commands; commands=() + _describe -t commands 'innernet help add-cidr commands' commands "$@" +} (( $+functions[_innernet__add-peer_commands] )) || _innernet__add-peer_commands() { local commands; commands=() _describe -t commands 'innernet add-peer commands' commands "$@" } +(( $+functions[_innernet__help__add-peer_commands] )) || +_innernet__help__add-peer_commands() { + local commands; commands=() + _describe -t commands 'innernet help add-peer commands' commands "$@" +} (( $+functions[_innernet__completions_commands] )) || _innernet__completions_commands() { local commands; commands=() _describe -t commands 'innernet completions commands' commands "$@" } +(( $+functions[_innernet__help__completions_commands] )) || +_innernet__help__completions_commands() { + local commands; commands=() + _describe -t commands 'innernet help completions commands' commands "$@" +} (( $+functions[_innernet__delete-association_commands] )) || _innernet__delete-association_commands() { local commands; commands=() _describe -t commands 'innernet delete-association commands' commands "$@" } +(( $+functions[_innernet__help__delete-association_commands] )) || +_innernet__help__delete-association_commands() { + local commands; commands=() + _describe -t commands 'innernet help delete-association commands' commands "$@" +} (( $+functions[_innernet__delete-cidr_commands] )) || _innernet__delete-cidr_commands() { local commands; commands=() _describe -t commands 'innernet delete-cidr commands' commands "$@" } +(( $+functions[_innernet__help__delete-cidr_commands] )) || +_innernet__help__delete-cidr_commands() { + local commands; commands=() + _describe -t commands 'innernet help delete-cidr commands' commands "$@" +} (( $+functions[_innernet__disable-peer_commands] )) || _innernet__disable-peer_commands() { local commands; commands=() _describe -t commands 'innernet disable-peer commands' commands "$@" } +(( $+functions[_innernet__help__disable-peer_commands] )) || +_innernet__help__disable-peer_commands() { + local commands; commands=() + _describe -t commands 'innernet help disable-peer commands' commands "$@" +} (( $+functions[_innernet__down_commands] )) || _innernet__down_commands() { local commands; commands=() _describe -t commands 'innernet down commands' commands "$@" } +(( $+functions[_innernet__help__down_commands] )) || +_innernet__help__down_commands() { + local commands; commands=() + _describe -t commands 'innernet help down commands' commands "$@" +} (( $+functions[_innernet__enable-peer_commands] )) || _innernet__enable-peer_commands() { local commands; commands=() _describe -t commands 'innernet enable-peer commands' commands "$@" } +(( $+functions[_innernet__help__enable-peer_commands] )) || +_innernet__help__enable-peer_commands() { + local commands; commands=() + _describe -t commands 'innernet help enable-peer commands' commands "$@" +} (( $+functions[_innernet__fetch_commands] )) || _innernet__fetch_commands() { local commands; commands=() _describe -t commands 'innernet fetch commands' commands "$@" } +(( $+functions[_innernet__help__fetch_commands] )) || +_innernet__help__fetch_commands() { + local commands; commands=() + _describe -t commands 'innernet help fetch commands' commands "$@" +} (( $+functions[_innernet__help_commands] )) || _innernet__help_commands() { - local commands; commands=() + local commands; commands=( +'install:Install a new innernet config' \ +'show:Enumerate all innernet connections' \ +'up:Bring up your local interface, and update it with latest peer list' \ +'fetch:Fetch and update your local interface with the latest peer list' \ +'uninstall:Uninstall an innernet network' \ +'down:Bring down the interface (equivalent to '\''wg-quick down '\'')' \ +'add-peer:Add a new peer' \ +'rename-peer:Rename a peer' \ +'add-cidr:Add a new CIDR' \ +'delete-cidr:Delete a CIDR' \ +'list-cidrs:List CIDRs' \ +'disable-peer:Disable an enabled peer' \ +'enable-peer:Enable a disabled peer' \ +'add-association:Add an association between CIDRs' \ +'delete-association:Delete an association between CIDRs' \ +'list-associations:List existing assocations between CIDRs' \ +'set-listen-port:Set the local listen port' \ +'override-endpoint:Override your external endpoint that the server sends to other peers' \ +'completions:Generate shell completion scripts' \ +'help:Print this message or the help of the given subcommand(s)' \ + ) _describe -t commands 'innernet help commands' commands "$@" } +(( $+functions[_innernet__help__help_commands] )) || +_innernet__help__help_commands() { + local commands; commands=() + _describe -t commands 'innernet help help commands' commands "$@" +} +(( $+functions[_innernet__help__install_commands] )) || +_innernet__help__install_commands() { + local commands; commands=() + _describe -t commands 'innernet help install commands' commands "$@" +} (( $+functions[_innernet__install_commands] )) || _innernet__install_commands() { local commands; commands=() _describe -t commands 'innernet install commands' commands "$@" } +(( $+functions[_innernet__help__list-associations_commands] )) || +_innernet__help__list-associations_commands() { + local commands; commands=() + _describe -t commands 'innernet help list-associations commands' commands "$@" +} (( $+functions[_innernet__list-associations_commands] )) || _innernet__list-associations_commands() { local commands; commands=() _describe -t commands 'innernet list-associations commands' commands "$@" } +(( $+functions[_innernet__help__list-cidrs_commands] )) || +_innernet__help__list-cidrs_commands() { + local commands; commands=() + _describe -t commands 'innernet help list-cidrs commands' commands "$@" +} (( $+functions[_innernet__list-cidrs_commands] )) || _innernet__list-cidrs_commands() { local commands; commands=() _describe -t commands 'innernet list-cidrs commands' commands "$@" } +(( $+functions[_innernet__help__override-endpoint_commands] )) || +_innernet__help__override-endpoint_commands() { + local commands; commands=() + _describe -t commands 'innernet help override-endpoint commands' commands "$@" +} (( $+functions[_innernet__override-endpoint_commands] )) || _innernet__override-endpoint_commands() { local commands; commands=() _describe -t commands 'innernet override-endpoint commands' commands "$@" } +(( $+functions[_innernet__help__rename-peer_commands] )) || +_innernet__help__rename-peer_commands() { + local commands; commands=() + _describe -t commands 'innernet help rename-peer commands' commands "$@" +} (( $+functions[_innernet__rename-peer_commands] )) || _innernet__rename-peer_commands() { local commands; commands=() _describe -t commands 'innernet rename-peer commands' commands "$@" } +(( $+functions[_innernet__help__set-listen-port_commands] )) || +_innernet__help__set-listen-port_commands() { + local commands; commands=() + _describe -t commands 'innernet help set-listen-port commands' commands "$@" +} (( $+functions[_innernet__set-listen-port_commands] )) || _innernet__set-listen-port_commands() { local commands; commands=() _describe -t commands 'innernet set-listen-port commands' commands "$@" } +(( $+functions[_innernet__help__show_commands] )) || +_innernet__help__show_commands() { + local commands; commands=() + _describe -t commands 'innernet help show commands' commands "$@" +} (( $+functions[_innernet__show_commands] )) || _innernet__show_commands() { local commands; commands=() _describe -t commands 'innernet show commands' commands "$@" } +(( $+functions[_innernet__help__uninstall_commands] )) || +_innernet__help__uninstall_commands() { + local commands; commands=() + _describe -t commands 'innernet help uninstall commands' commands "$@" +} (( $+functions[_innernet__uninstall_commands] )) || _innernet__uninstall_commands() { local commands; commands=() _describe -t commands 'innernet uninstall commands' commands "$@" } +(( $+functions[_innernet__help__up_commands] )) || +_innernet__help__up_commands() { + local commands; commands=() + _describe -t commands 'innernet help up commands' commands "$@" +} (( $+functions[_innernet__up_commands] )) || _innernet__up_commands() { local commands; commands=() _describe -t commands 'innernet up commands' commands "$@" } -_innernet "$@" +if [ "$funcstack[1]" = "_innernet" ]; then + _innernet "$@" +else + compdef _innernet innernet +fi diff --git a/netlink-request/Cargo.toml b/netlink-request/Cargo.toml index 728a3d9b..938bc22b 100644 --- a/netlink-request/Cargo.toml +++ b/netlink-request/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "netlink-request" -version = "1.5.5" +version = "1.6.0" edition = "2021" [target.'cfg(target_os = "linux")'.dependencies] diff --git a/server/Cargo.toml b/server/Cargo.toml index 87db7858..52159136 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -13,7 +13,7 @@ name = "server" publish = false readme = "README.md" repository = "https://github.com/tonarino/innernet" -version = "1.5.5" +version = "1.6.0" [[bin]] name = "innernet-server" diff --git a/shared/Cargo.toml b/shared/Cargo.toml index 744a9699..2e859122 100644 --- a/shared/Cargo.toml +++ b/shared/Cargo.toml @@ -9,7 +9,7 @@ edition = "2021" license = "MIT" name = "shared" publish = false -version = "1.5.5" +version = "1.6.0" [dependencies] anyhow = "1" diff --git a/wireguard-control/Cargo.toml b/wireguard-control/Cargo.toml index 846ba910..fa9b1d61 100644 --- a/wireguard-control/Cargo.toml +++ b/wireguard-control/Cargo.toml @@ -7,7 +7,7 @@ license = "LGPL-2.1-or-later" name = "wireguard-control" readme = "README.md" repository = "https://github.com/tonarino/innernet" -version = "1.5.5" +version = "1.6.0" [dependencies] base64 = "0.13.1" From db914c2ec8ededb3ac25c0df1a657b2570c05241 Mon Sep 17 00:00:00 2001 From: juanito87 Date: Thu, 14 Sep 2023 16:43:40 -0300 Subject: [PATCH 16/16] Updating clippy error. --- wireguard-control/src/backends/kernel.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wireguard-control/src/backends/kernel.rs b/wireguard-control/src/backends/kernel.rs index a0c7e6c1..f0499574 100644 --- a/wireguard-control/src/backends/kernel.rs +++ b/wireguard-control/src/backends/kernel.rs @@ -366,7 +366,7 @@ pub fn get_by_name(name: &InterfaceName) -> Result { responses.len() ); - let nlas = responses.into_iter().fold(Ok(vec![]), |nlas_res, nlmsg| { + let nlas = responses.into_iter().try_fold(Ok(vec![]), |nlas_res, nlmsg| { let mut nlas = nlas_res?; let mut message = match nlmsg { NetlinkMessage {