From 1dc8e3655684adc6a381785d6eb9255b2baa6c50 Mon Sep 17 00:00:00 2001 From: Iam54r1n4 Date: Sun, 26 Jan 2025 13:01:20 +0000 Subject: [PATCH] Separate masquerade management --- core/cli_api.py | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/core/cli_api.py b/core/cli_api.py index 734a4cf..b3450e4 100644 --- a/core/cli_api.py +++ b/core/cli_api.py @@ -157,6 +157,15 @@ def disable_hysteria2_obfs(): '''Removes 'obfs' from Hysteria2 configuration.''' run_cmd(['bash', Command.MANAGE_OBFS.value, '--remove']) + +def enable_hysteria2_masquerade(domain: str): + '''Enables masquerade for Hysteria2.''' + run_cmd(['bash', Command.MASQUERADE_SCRIPT.value, '1', domain]) + + +def disable_hysteria2_masquerade(): + '''Disables masquerade for Hysteria2.''' + run_cmd(['bash', Command.MASQUERADE_SCRIPT.value, '2']) # endregion # region User @@ -301,19 +310,6 @@ def update_geo(country: str): raise HysteriaError(f'An unexpected error occurred: {e}') -def masquerade(remove: bool, enable: str): - ''' - Configures masquerade settings. - ''' - if remove and enable: - raise InvalidInputError('Error: You cannot use both --remove and --enable at the same time.') - if remove: - run_cmd(['bash', Command.MASQUERADE_SCRIPT.value, '2']) - elif enable: - run_cmd(['bash', Command.MASQUERADE_SCRIPT.value, '1', enable]) - else: - raise InvalidInputError('Error: Please specify either --remove or --enable.') - # endregion # region Advanced Menu