From 07f5aa7e1ce9cc4f75c6803f17fd3382f2727076 Mon Sep 17 00:00:00 2001 From: wingsman2 Date: Mon, 17 Oct 2022 12:27:03 -0400 Subject: [PATCH] Update Server.js --- src/lib/Server.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/lib/Server.js b/src/lib/Server.js index f8f380bd..725f444a 100644 --- a/src/lib/Server.js +++ b/src/lib/Server.js @@ -109,8 +109,8 @@ module.exports = class Server { res.send(config); })) .post('/api/wireguard/client', Util.promisify(async req => { - const { name } = req.body; - return WireGuard.createClient({ name }); + const { name, allowedGWIPs } = req.body; + return WireGuard.createClient({ name, allowedGWIPs }); })) .delete('/api/wireguard/client/:clientId', Util.promisify(async req => { const { clientId } = req.params; @@ -134,6 +134,11 @@ module.exports = class Server { const { address } = req.body; return WireGuard.updateClientAddress({ clientId, address }); })) + .put('/api/wireguard/client/:clientId/allowedGWIPs', Util.promisify(async req => { + const { clientId } = req.params; + const { allowedGWIPs } = req.body; + return WireGuard.updateClientAllowIPS({ clientId, allowedGWIPs }); + })) .listen(PORT, () => { debug(`Listening on http://0.0.0.0:${PORT}`);