Change SNI

This commit is contained in:
ReturnFI
2024-09-05 13:22:35 +00:00
parent cee86069b2
commit 0496e35126
3 changed files with 11 additions and 6 deletions

View File

@ -74,9 +74,13 @@ def cli():
@cli.command('install-hysteria2')
@click.option('--port', '-p', required=True, help='New port for Hysteria2', type=int, callback=validator.validate_port)
def install_hysteria2(port: int):
run_cmd(['bash', Command.INSTALL_HYSTERIA2.value, str(port)])
@click.option('--port', '-p', required=True, help='Port for Hysteria2', type=int, callback=validator.validate_port)
@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):
"""
Installs Hysteria2 on the given port and uses the provided or default SNI value.
"""
run_cmd(['bash', Command.INSTALL_HYSTERIA2.value, str(port), sni])
@cli.command('uninstall-hysteria2')

View File

@ -14,7 +14,7 @@ install_hysteria() {
echo "Generating CA key and certificate..."
openssl ecparam -genkey -name prime256v1 -out ca.key >/dev/null 2>&1
openssl req -new -x509 -days 36500 -key ca.key -out ca.crt -subj "/CN=bts.com" >/dev/null 2>&1
openssl req -new -x509 -days 36500 -key ca.key -out ca.crt -subj "/CN=$sni" >/dev/null 2>&1
echo "Downloading geo data..."
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