meta: cargo clippy & fmt
parent
61b055c44b
commit
82325509db
|
@ -895,18 +895,18 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
|||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.126"
|
||||
version = "1.0.127"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec7505abeacaec74ae4778d9d9328fe5a5d04253220a85c4ee022239fc996d03"
|
||||
checksum = "f03b9878abf6d14e6779d3f24f07b2cfa90352cfec4acc5aab8f1ac7f146fae8"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.126"
|
||||
version = "1.0.127"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "963a7dbc9895aeac7ac90e74f34a5d5261828f79df35cbed41e10189d3804d43"
|
||||
checksum = "a024926d3432516606328597e0f224a51355a493b49fdd67e9209187cbe55ecc"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -915,9 +915,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.64"
|
||||
version = "1.0.66"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79"
|
||||
checksum = "336b10da19a12ad094b59d870ebde26a45402e5b470add4b5fd03c5048a32127"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
|
@ -997,9 +997,9 @@ checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e"
|
|||
|
||||
[[package]]
|
||||
name = "socket2"
|
||||
version = "0.4.0"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e3dfc207c526015c632472a77be09cf1b6e46866581aecae5cc38fb4235dea2"
|
||||
checksum = "765f090f0e423d2b55843402a07915add955e7d60657db13707a159727326cad"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"winapi",
|
||||
|
|
|
@ -284,10 +284,19 @@ fn install(
|
|||
|
||||
let target_conf = CLIENT_CONFIG_DIR.join(&iface).with_extension("conf");
|
||||
if target_conf.exists() {
|
||||
bail!("An existing innernet network with the name \"{}\" already exists.", iface);
|
||||
bail!(
|
||||
"An existing innernet network with the name \"{}\" already exists.",
|
||||
iface
|
||||
);
|
||||
}
|
||||
if Device::list(network.backend)?.iter().any(|name| name.as_str_lossy() == iface) {
|
||||
bail!("An existing WireGuard interface with the name \"{}\" already exists.", iface);
|
||||
if Device::list(network.backend)?
|
||||
.iter()
|
||||
.any(|name| name.as_str_lossy() == iface)
|
||||
{
|
||||
bail!(
|
||||
"An existing WireGuard interface with the name \"{}\" already exists.",
|
||||
iface
|
||||
);
|
||||
}
|
||||
|
||||
let iface = iface.parse()?;
|
||||
|
|
|
@ -3,7 +3,14 @@ use crate::{Backend, Device, DeviceUpdate, InterfaceName, PeerConfig, PeerInfo,
|
|||
#[cfg(target_os = "linux")]
|
||||
use crate::Key;
|
||||
|
||||
use std::{fs, io::{self, prelude::*, BufReader}, os::unix::net::UnixStream, path::{Path, PathBuf}, process::{Command, Output}, time::{Duration, SystemTime}};
|
||||
use std::{
|
||||
fs,
|
||||
io::{self, prelude::*, BufReader},
|
||||
os::unix::net::UnixStream,
|
||||
path::{Path, PathBuf},
|
||||
process::{Command, Output},
|
||||
time::{Duration, SystemTime},
|
||||
};
|
||||
|
||||
static VAR_RUN_PATH: &str = "/var/run/wireguard";
|
||||
static RUN_PATH: &str = "/run/wireguard";
|
||||
|
@ -59,7 +66,8 @@ pub fn enumerate() -> Result<Vec<InterfaceName>, io::Error> {
|
|||
for entry in fs::read_dir(get_base_folder()?)? {
|
||||
let path = entry?.path();
|
||||
if path.extension() == Some(OsStr::new("name")) {
|
||||
let stem = path.file_stem()
|
||||
let stem = path
|
||||
.file_stem()
|
||||
.and_then(|stem| stem.to_str())
|
||||
.and_then(|name| name.parse::<InterfaceName>().ok())
|
||||
.filter(|iface| open_socket(iface).is_ok());
|
||||
|
|
Loading…
Reference in New Issue