Browse Source

Update Server.js

pull/400/head
wingsman2 4 years ago
committed by GitHub
parent
commit
07f5aa7e1c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      src/lib/Server.js

9
src/lib/Server.js

@ -109,8 +109,8 @@ module.exports = class Server {
res.send(config); res.send(config);
})) }))
.post('/api/wireguard/client', Util.promisify(async req => { .post('/api/wireguard/client', Util.promisify(async req => {
const { name } = req.body; const { name, allowedGWIPs } = req.body;
return WireGuard.createClient({ name }); return WireGuard.createClient({ name, allowedGWIPs });
})) }))
.delete('/api/wireguard/client/:clientId', Util.promisify(async req => { .delete('/api/wireguard/client/:clientId', Util.promisify(async req => {
const { clientId } = req.params; const { clientId } = req.params;
@ -134,6 +134,11 @@ module.exports = class Server {
const { address } = req.body; const { address } = req.body;
return WireGuard.updateClientAddress({ clientId, address }); 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, () => { .listen(PORT, () => {
debug(`Listening on http://0.0.0.0:${PORT}`); debug(`Listening on http://0.0.0.0:${PORT}`);

Loading…
Cancel
Save