Change SNI
This commit is contained in:
10
core/cli.py
10
core/cli.py
@ -74,9 +74,13 @@ def cli():
|
|||||||
|
|
||||||
|
|
||||||
@cli.command('install-hysteria2')
|
@cli.command('install-hysteria2')
|
||||||
@click.option('--port', '-p', required=True, help='New port for Hysteria2', type=int, callback=validator.validate_port)
|
@click.option('--port', '-p', required=True, help='Port for Hysteria2', type=int, callback=validator.validate_port)
|
||||||
def install_hysteria2(port: int):
|
@click.option('--sni', '-s', required=False, default='bts.com', help='SNI for Hysteria2 (default: bts.com)', type=str)
|
||||||
run_cmd(['bash', Command.INSTALL_HYSTERIA2.value, str(port)])
|
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')
|
@cli.command('uninstall-hysteria2')
|
||||||
|
|||||||
@ -14,7 +14,7 @@ install_hysteria() {
|
|||||||
|
|
||||||
echo "Generating CA key and certificate..."
|
echo "Generating CA key and certificate..."
|
||||||
openssl ecparam -genkey -name prime256v1 -out ca.key >/dev/null 2>&1
|
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..."
|
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/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
|
||||||
|
|||||||
5
menu.sh
5
menu.sh
@ -12,7 +12,8 @@ hysteria2_install_handler() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
read -p "Enter the new port number you want to use: " port
|
read -p "Enter the SNI (default: bts.com): " sni
|
||||||
|
read -p "Enter the port number you want to use: " port
|
||||||
if ! [[ "$port" =~ ^[0-9]+$ ]] || [ "$port" -lt 1 ] || [ "$port" -gt 65535 ]; then
|
if ! [[ "$port" =~ ^[0-9]+$ ]] || [ "$port" -lt 1 ] || [ "$port" -gt 65535 ]; then
|
||||||
echo "Invalid port number. Please enter a number between 1 and 65535."
|
echo "Invalid port number. Please enter a number between 1 and 65535."
|
||||||
else
|
else
|
||||||
@ -20,7 +21,7 @@ hysteria2_install_handler() {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
python3 $CLI_PATH install-hysteria2 --port "$port"
|
python3 $CLI_PATH install-hysteria2 --port "$port" --sni "$sni"
|
||||||
}
|
}
|
||||||
|
|
||||||
hysteria2_add_user_handler() {
|
hysteria2_add_user_handler() {
|
||||||
|
|||||||
Reference in New Issue
Block a user