From c4f743e2a33ba39036f7e9919b7adc80415b1754 Mon Sep 17 00:00:00 2001 From: Hristo Venev Date: Tue, 4 Feb 2020 20:31:51 +0100 Subject: Reference preshared keys by path. --- src/manager/builder.rs | 4 ++-- src/manager/mod.rs | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src/manager') diff --git a/src/manager/builder.rs b/src/manager/builder.rs index 9580d07..6ee71f2 100644 --- a/src/manager/builder.rs +++ b/src/manager/builder.rs @@ -135,7 +135,7 @@ fn insert_peer<'b>( err: &mut Vec, src: &Source, p: &proto::Peer, - psk: Option<&model::Key>, + psk: Option<&model::Secret>, update: impl for<'c> FnOnce(&'c mut model::Peer) -> (), ) -> &'b mut model::Peer { match c.peers.entry(p.public_key) { @@ -161,7 +161,7 @@ fn find_psk<'a>( gc: &'a config::GlobalConfig, src: &'a Source, p: &proto::Peer, -) -> Result, Error> { +) -> Result, Error> { let want = match gc.peers.get(&p.public_key) { Some(v) => v, None => return Ok(None), diff --git a/src/manager/mod.rs b/src/manager/mod.rs index 8df4d23..b7fb8c2 100644 --- a/src/manager/mod.rs +++ b/src/manager/mod.rs @@ -35,10 +35,12 @@ impl Manager { let runtime_directory = c.runtime_directory.ok_or_else(|| { io::Error::new(io::ErrorKind::InvalidInput, "runtime directory required") })?; - let mut state_path = runtime_directory.clone(); + + let mut state_path = runtime_directory; state_path.push("state.json"); + let mut m = Self { - dev: wg::Device::open(ifname, runtime_directory)?, + dev: wg::Device::open(ifname)?, global_config: c.global, sources: vec![], current: model::Config::empty(), -- cgit