From 8107973342a31e8d654d31c1bb06786fc033d86c Mon Sep 17 00:00:00 2001 From: Mathias Hall-Andersen Date: Wed, 23 Oct 2019 14:00:21 +0200 Subject: Work on pure WireGuard test --- src/configuration/config.rs | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src/configuration/config.rs') diff --git a/src/configuration/config.rs b/src/configuration/config.rs index f42b53b..6aa6a77 100644 --- a/src/configuration/config.rs +++ b/src/configuration/config.rs @@ -103,7 +103,7 @@ pub trait Configuration { /// # Returns /// /// If the peer does not exists this operation is a noop - fn remove_peer(&self, peer: PublicKey); + fn remove_peer(&self, peer: &PublicKey); /// Adds a new peer to the device /// @@ -116,7 +116,7 @@ pub trait Configuration { /// A bool indicating if the peer was added. /// /// If the peer already exists this operation is a noop - fn add_peer(&self, peer: PublicKey) -> bool; + fn add_peer(&self, peer: &PublicKey) -> bool; /// Update the psk of a peer /// @@ -128,7 +128,7 @@ pub trait Configuration { /// # Returns /// /// An error if no such peer exists - fn set_preshared_key(&self, peer: PublicKey, psk: Option<[u8; 32]>) -> Option; + fn set_preshared_key(&self, peer: &PublicKey, psk: Option<[u8; 32]>) -> Option; /// Update the endpoint of the /// @@ -136,7 +136,7 @@ pub trait Configuration { /// /// - `peer': The public key of the peer /// - `psk` - fn set_endpoint(&self, peer: PublicKey, addr: SocketAddr) -> Option; + fn set_endpoint(&self, peer: &PublicKey, addr: SocketAddr) -> Option; /// Update the endpoint of the /// @@ -146,7 +146,7 @@ pub trait Configuration { /// - `psk` fn set_persistent_keepalive_interval( &self, - peer: PublicKey, + peer: &PublicKey, interval: usize, ) -> Option; @@ -159,7 +159,7 @@ pub trait Configuration { /// # Returns /// /// An error if no such peer exists - fn replace_allowed_ips(&self, peer: PublicKey) -> Option; + fn replace_allowed_ips(&self, peer: &PublicKey) -> Option; /// Add a new allowed subnet to the peer /// @@ -177,7 +177,7 @@ pub trait Configuration { /// /// The API must itself sanitize the (ip, masklen) set: /// The ip should be masked to remove any set bits right of the first "masklen" bits. - fn add_allowed_ip(&self, peer: PublicKey, ip: IpAddr, masklen: u32) -> Option; + fn add_allowed_ip(&self, peer: &PublicKey, ip: IpAddr, masklen: u32) -> Option; /// Returns the state of all peers /// @@ -228,36 +228,36 @@ impl Configuration for WireguardConfig { self.wireguard.clear_peers(); } - fn remove_peer(&self, peer: PublicKey) { + fn remove_peer(&self, peer: &PublicKey) { self.wireguard.remove_peer(peer); } - fn add_peer(&self, peer: PublicKey) -> bool { - self.wireguard.new_peer(peer); + fn add_peer(&self, peer: &PublicKey) -> bool { + self.wireguard.new_peer(*peer); false } - fn set_preshared_key(&self, peer: PublicKey, psk: Option<[u8; 32]>) -> Option { + fn set_preshared_key(&self, peer: &PublicKey, psk: Option<[u8; 32]>) -> Option { None } - fn set_endpoint(&self, peer: PublicKey, addr: SocketAddr) -> Option { + fn set_endpoint(&self, peer: &PublicKey, addr: SocketAddr) -> Option { None } fn set_persistent_keepalive_interval( &self, - peer: PublicKey, + peer: &PublicKey, interval: usize, ) -> Option { None } - fn replace_allowed_ips(&self, peer: PublicKey) -> Option { + fn replace_allowed_ips(&self, peer: &PublicKey) -> Option { None } - fn add_allowed_ip(&self, peer: PublicKey, ip: IpAddr, masklen: u32) -> Option { + fn add_allowed_ip(&self, peer: &PublicKey, ip: IpAddr, masklen: u32) -> Option { None } -- cgit v1.2.3-59-g8ed1b