Added Normal Sub

This commit is contained in:
Whispering Wind
2024-10-06 21:44:00 +03:30
committed by GitHub
parent 4bc59b4858
commit 85bd0ce260

View File

@ -35,6 +35,7 @@ class Command(Enum):
BACKUP_HYSTERIA = os.path.join(SCRIPT_DIR, 'hysteria2', 'backup.sh')
INSTALL_TELEGRAMBOT = os.path.join(SCRIPT_DIR, 'telegrambot', 'runbot.sh')
INSTALL_SINGBOX = os.path.join(SCRIPT_DIR, 'singbox', 'singbox_shell.sh')
INSTALL_NORMALSUB = os.path.join(SCRIPT_DIR, 'normalsub', 'normalsub.sh')
INSTALL_TCP_BRUTAL = os.path.join(SCRIPT_DIR, 'tcp-brutal', 'install.sh')
INSTALL_WARP = os.path.join(SCRIPT_DIR, 'warp', 'install.sh')
UNINSTALL_WARP = os.path.join(SCRIPT_DIR, 'warp', 'uninstall.sh')
@ -325,6 +326,19 @@ def singbox(action: str, domain: str, port: int):
elif action == 'stop':
run_cmd(['bash', Command.INSTALL_SINGBOX.value, 'stop'])
@cli.command('normal-sub')
@click.option('--action', '-a', required=True, help='Action to perform: start or stop', type=click.Choice(['start', 'stop'], case_sensitive=False))
@click.option('--domain', '-d', required=False, help='Domain name for SSL', type=str)
@click.option('--port', '-p', required=False, help='Port number for NormalSub service', type=int)
def normalsub(action: str, domain: str, port: int):
if action == 'start':
if not domain or not port:
click.echo("Error: Both --domain and --port are required for the start action.")
return
run_cmd(['bash', Command.INSTALL_NORMALSUB.value, 'start', domain, str(port)])
elif action == 'stop':
run_cmd(['bash', Command.INSTALL_NORMALSUB.value, 'stop'])
# endregion