aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2023-03-09 11:08:05 +0100
committerAlex Auvolat <alex@adnab.me>2023-03-09 11:08:05 +0100
commite82b0b71f90788da7049a3d3695de9cb0f0164e7 (patch)
treee5f66cc7a5ea40c1cf5a6d78bedcf91643b74641 /src
parent7328fc3929b182c2087a539ffb11b492a2201af0 (diff)
downloadwgautomesh-e82b0b71f90788da7049a3d3695de9cb0f0164e7.tar.gz
wgautomesh-e82b0b71f90788da7049a3d3695de9cb0f0164e7.zip
fail with error message instead of panic
Diffstat (limited to 'src')
-rw-r--r--src/main.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index 7e0f013..be73856 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -90,6 +90,12 @@ fn wg_dump(config: &Config) -> Result<(Pubkey, u16, Vec<(Pubkey, Option<SocketAd
let mut lines = std::str::from_utf8(&output.stdout)?.split('\n');
let ourself = lines.next().unwrap().split('\t').collect::<Vec<_>>();
+ if ourself.len() < 3 {
+ bail!(
+ "Unable to fetch wireguard status for interface {}",
+ config.interface
+ );
+ }
let our_pubkey = ourself[1].to_string();
let listen_port = ourself[2].parse::<u16>()?;