From 643554bd57a13c156e899def63f93ed6ba4c9977 Mon Sep 17 00:00:00 2001 From: Iam54r1n4 Date: Sun, 26 Jan 2025 13:03:58 +0000 Subject: [PATCH] Add api/v1/config/hysteria/enable-masquerade|disable-masquerade endpoints --- .../webpanel/routers/api/v1/config/hysteria.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/core/scripts/webpanel/routers/api/v1/config/hysteria.py b/core/scripts/webpanel/routers/api/v1/config/hysteria.py index 738bd0a..a258998 100644 --- a/core/scripts/webpanel/routers/api/v1/config/hysteria.py +++ b/core/scripts/webpanel/routers/api/v1/config/hysteria.py @@ -76,3 +76,21 @@ async def disable_obfs(): return DetailResponse(detail='Hysteria2 obfs disabled successfully.') except Exception as e: raise HTTPException(status_code=400, detail=f'Error: {str(e)}') + + +@router.get('/enable-masquerade/{domain}', response_model=DetailResponse) +async def enable_masquerade(domain: str): + try: + cli_api.enable_hysteria2_masquerade(domain) + return DetailResponse(detail='Hysteria2 masquerade enabled successfully.') + except Exception as e: + raise HTTPException(status_code=400, detail=f'Error: {str(e)}') + + +@router.get('/disable-masquerade', response_model=DetailResponse) +async def disable_masquerade(): + try: + cli_api.disable_hysteria2_masquerade() + return DetailResponse(detail='Hysteria2 masquerade disabled successfully.') + except Exception as e: + raise HTTPException(status_code=400, detail=f'Error: {str(e)}')