|
|
@ -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}`); |
|
|
|