fix(cli): update install_hysteria2 to return output message
This commit is contained in:
@ -26,8 +26,8 @@ def cli():
|
|||||||
@click.option('--sni', '-s', required=False, default='bts.com', help='SNI for Hysteria2 (default: bts.com)', type=str)
|
@click.option('--sni', '-s', required=False, default='bts.com', help='SNI for Hysteria2 (default: bts.com)', type=str)
|
||||||
def install_hysteria2(port: int, sni: str):
|
def install_hysteria2(port: int, sni: str):
|
||||||
try:
|
try:
|
||||||
cli_api.install_hysteria2(port, sni)
|
output = cli_api.install_hysteria2(port, sni)
|
||||||
click.echo(f'Hysteria2 installed successfully on port {port} with SNI {sni}.')
|
click.echo(output)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
click.echo(f'{e}', err=True)
|
click.echo(f'{e}', err=True)
|
||||||
|
|
||||||
|
|||||||
@ -138,11 +138,11 @@ def generate_password() -> str:
|
|||||||
# region Hysteria
|
# region Hysteria
|
||||||
|
|
||||||
|
|
||||||
def install_hysteria2(port: int, sni: str):
|
def install_hysteria2(port: int, sni: str) -> str:
|
||||||
'''
|
'''
|
||||||
Installs Hysteria2 on the given port and uses the provided or default SNI value.
|
Installs Hysteria2 on the given port and uses the provided or default SNI value.
|
||||||
'''
|
'''
|
||||||
run_cmd(['bash', Command.INSTALL_HYSTERIA2.value, str(port), sni])
|
return run_cmd(['bash', Command.INSTALL_HYSTERIA2.value, str(port), sni])
|
||||||
|
|
||||||
|
|
||||||
def uninstall_hysteria2():
|
def uninstall_hysteria2():
|
||||||
|
|||||||
@ -21,7 +21,7 @@ install_hysteria() {
|
|||||||
wget -O /etc/hysteria/geosite.dat https://raw.githubusercontent.com/Chocolate4U/Iran-v2ray-rules/release/geosite.dat >/dev/null 2>&1
|
wget -O /etc/hysteria/geosite.dat https://raw.githubusercontent.com/Chocolate4U/Iran-v2ray-rules/release/geosite.dat >/dev/null 2>&1
|
||||||
wget -O /etc/hysteria/geoip.dat https://raw.githubusercontent.com/Chocolate4U/Iran-v2ray-rules/release/geoip.dat >/dev/null 2>&1
|
wget -O /etc/hysteria/geoip.dat https://raw.githubusercontent.com/Chocolate4U/Iran-v2ray-rules/release/geoip.dat >/dev/null 2>&1
|
||||||
|
|
||||||
echo "Generating base64 encoded SHA-256 fingerprint..."
|
echo "Generating SHA-256 fingerprint..."
|
||||||
|
|
||||||
sha256=$(openssl x509 -noout -fingerprint -sha256 -inform pem -in ca.crt | sed 's/.*=//;s///g')
|
sha256=$(openssl x509 -noout -fingerprint -sha256 -inform pem -in ca.crt | sed 's/.*=//;s///g')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user