重构代码, update 端口相关函数

This commit is contained in:
Olia Lisa
2026-05-28 15:08:00 +08:00
parent 499b085f05
commit c0824d99c0
3 changed files with 38 additions and 23 deletions
+8 -6
View File
@@ -27,15 +27,16 @@ create_hysteria_config(){
create_hysteria_self_tls_config() {
local SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # 脚本文件夹绝对路径
local CONFIG_FILE="$SCRIPT_DIR/../config/config.json"
local CONFIG_DIR="$SCRIPT_DIR/../config"
local CONFIG_FILE="$CONFIG_DIR/config.json"
cp "$SCRIPT_DIR/../config/template/hysteria/hysteria_self_tls_config.json" "$CONFIG_FILE"
cp "$CONFIG_DIR/template/hysteria/hysteria_self_tls_config.json" "$CONFIG_FILE"
# 生成自签名证书和设置域名
update_self_tls "$CONFIG_FILE" "bing.com"
# 设置端口
update_port
update_port "$CONFIG_FILE"
# 设置密码
update_password "$CONFIG_FILE"
@@ -48,14 +49,15 @@ create_hysteria_self_tls_config() {
create_hysteria_acme_tls_config() {
local SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # 脚本文件夹绝对路径
local CONFIG_FILE="$SCRIPT_DIR/../config/config.json"
local CONFIG_DIR="$SCRIPT_DIR/../config"
local CONFIG_FILE="$CONFIG_DIR/config.json"
cp "$SCRIPT_DIR/../config/template/hysteria/hysteria_acme_tls_config.json" "$CONFIG_FILE"
cp "$CONFIG_DIR/template/hysteria/hysteria_acme_tls_config.json" "$CONFIG_FILE"
update_acme_tls "$CONFIG_FILE"
# 设置端口
update_port
update_port "$CONFIG_FILE"
# 设置密码
update_password "$CONFIG_FILE"