diff options
author | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2019-12-26 22:55:33 +0100 |
---|---|---|
committer | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2019-12-26 22:55:33 +0100 |
commit | bb0a8acea3161a08ac69cc2e35489f8d33741d1a (patch) | |
tree | e81a6384c4dc26743b67937fd0e0e721a73dc5b3 /src/configuration/config.rs | |
parent | Remove unused test code. (diff) | |
download | wireguard-rs-bb0a8acea3161a08ac69cc2e35489f8d33741d1a.tar.xz wireguard-rs-bb0a8acea3161a08ac69cc2e35489f8d33741d1a.zip |
Make under_load global for WireGuard device
Diffstat (limited to '')
-rw-r--r-- | src/configuration/config.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/configuration/config.rs b/src/configuration/config.rs index ac6e9a1..aec943f 100644 --- a/src/configuration/config.rs +++ b/src/configuration/config.rs @@ -27,24 +27,24 @@ pub struct PeerState { pub preshared_key: [u8; 32], // 0^32 is the "default value" (though treated like any other psk) } -pub struct WireguardConfig<T: tun::Tun, B: udp::PlatformUDP>(Arc<Mutex<Inner<T, B>>>); +pub struct WireGuardConfig<T: tun::Tun, B: udp::PlatformUDP>(Arc<Mutex<Inner<T, B>>>); struct Inner<T: tun::Tun, B: udp::PlatformUDP> { - wireguard: Wireguard<T, B>, + wireguard: WireGuard<T, B>, port: u16, bind: Option<B::Owner>, fwmark: Option<u32>, } -impl<T: tun::Tun, B: udp::PlatformUDP> WireguardConfig<T, B> { +impl<T: tun::Tun, B: udp::PlatformUDP> WireGuardConfig<T, B> { fn lock(&self) -> MutexGuard<Inner<T, B>> { self.0.lock().unwrap() } } -impl<T: tun::Tun, B: udp::PlatformUDP> WireguardConfig<T, B> { - pub fn new(wg: Wireguard<T, B>) -> WireguardConfig<T, B> { - WireguardConfig(Arc::new(Mutex::new(Inner { +impl<T: tun::Tun, B: udp::PlatformUDP> WireGuardConfig<T, B> { + pub fn new(wg: WireGuard<T, B>) -> WireGuardConfig<T, B> { + WireGuardConfig(Arc::new(Mutex::new(Inner { wireguard: wg, port: 0, bind: None, @@ -53,9 +53,9 @@ impl<T: tun::Tun, B: udp::PlatformUDP> WireguardConfig<T, B> { } } -impl<T: tun::Tun, B: udp::PlatformUDP> Clone for WireguardConfig<T, B> { +impl<T: tun::Tun, B: udp::PlatformUDP> Clone for WireGuardConfig<T, B> { fn clone(&self) -> Self { - WireguardConfig(self.0.clone()) + WireGuardConfig(self.0.clone()) } } @@ -195,7 +195,7 @@ pub trait Configuration { fn get_fwmark(&self) -> Option<u32>; } -impl<T: tun::Tun, B: udp::PlatformUDP> Configuration for WireguardConfig<T, B> { +impl<T: tun::Tun, B: udp::PlatformUDP> Configuration for WireGuardConfig<T, B> { fn up(&self, mtu: usize) { self.lock().wireguard.up(mtu); } |