From eedd0f415bde3523d43a784664fc4b4fe93fef7f Mon Sep 17 00:00:00 2001 From: dzania Date: Mon, 9 Oct 2023 14:39:49 +0200 Subject: [PATCH] Add preshared key support --- src/host.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/host.rs b/src/host.rs index 4827303..5a12141 100644 --- a/src/host.rs +++ b/src/host.rs @@ -145,6 +145,11 @@ impl Peer { if let Some(endpoint) = self.endpoint { attrs.push(WgPeerAttrs::Endpoint(endpoint)); } + + if let Some(preshared_key) = &self.preshared_key { + attrs.push(WgPeerAttrs::PresharedKey(preshared_key.as_array())); + } + attrs.push(WgPeerAttrs::Flags(WGPEER_F_REPLACE_ALLOWEDIPS)); let allowed_ips = self .allowed_ips