Add delete tunnel endpoint
This commit is contained in:
@@ -50,6 +50,20 @@ export default function(opt) {
|
||||
};
|
||||
});
|
||||
|
||||
router.get('/api/tunnels/:id/delete', async (ctx, next) => {
|
||||
const clientId = ctx.params.id;
|
||||
const client = manager.getClient(clientId);
|
||||
if (!client) {
|
||||
ctx.throw(404);
|
||||
return;
|
||||
}
|
||||
|
||||
manager.removeClient(clientId);
|
||||
ctx.body = {
|
||||
delete_status: "success",
|
||||
};
|
||||
});
|
||||
|
||||
app.use(router.routes());
|
||||
app.use(router.allowedMethods());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user