diff options
author | Hristo Venev <hristo@venev.name> | 2020-02-04 20:31:51 +0100 |
---|---|---|
committer | Hristo Venev <hristo@venev.name> | 2020-02-04 20:31:51 +0100 |
commit | c4f743e2a33ba39036f7e9919b7adc80415b1754 (patch) | |
tree | c708bbc6e089a1b66c61d189a010cb2a80aa0a34 /src/manager | |
parent | 3f5c00af303c1b706a74cafa58ff23b068f6d819 (diff) |
Reference preshared keys by path.
Diffstat (limited to 'src/manager')
-rw-r--r-- | src/manager/builder.rs | 4 | ||||
-rw-r--r-- | src/manager/mod.rs | 6 |
2 files changed, 6 insertions, 4 deletions
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<Error>, 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<Option<&'a model::Key>, Error> { +) -> Result<Option<&'a model::Secret>, 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(), |