Compare commits

...

2 Commits

Author SHA1 Message Date
dichgrem
d8d8962df1 fix:rm_singbox 2025-08-25 17:32:23 +08:00
dichgrem
053fd95952 feat:change_port 2025-08-25 16:44:08 +08:00

View File

@@ -72,6 +72,8 @@ install_singbox() {
printf "${YELLOW}请输入 SNI 域名 (默认: s0.awsstatic.com)${NC}" printf "${YELLOW}请输入 SNI 域名 (默认: s0.awsstatic.com)${NC}"
read -r SNI read -r SNI
SNI=${SNI:-s0.awsstatic.com} SNI=${SNI:-s0.awsstatic.com}
read -rp "请输入监听端口 (默认: 443) " PORT
PORT=${PORT:-443} # 如果用户没输入,则默认 443
update_singbox update_singbox
hash -r hash -r
@@ -90,7 +92,6 @@ install_singbox() {
SHORT_ID=$(openssl rand -hex 8) SHORT_ID=$(openssl rand -hex 8)
FP="chrome" FP="chrome"
SERVER_IP=$(curl -4 -s https://api.ipify.org) SERVER_IP=$(curl -4 -s https://api.ipify.org)
PORT=443
SPX="/" SPX="/"
mkdir -p "$CONFIG_DIR" mkdir -p "$CONFIG_DIR"
@@ -231,7 +232,7 @@ show_link() {
SHORT_ID=$(grep -oP '"short_id"\s*:\s*"\K[^"]+' "$CONFIG_DIR/config.json") SHORT_ID=$(grep -oP '"short_id"\s*:\s*"\K[^"]+' "$CONFIG_DIR/config.json")
FP="chrome" FP="chrome"
SERVER_IP=$(curl -s https://ifconfig.me) SERVER_IP=$(curl -s https://ifconfig.me)
PORT=443 PORT=$(grep -oP '"listen_port"\s*:\s*"\K[^"]+' "$CONFIG_DIR/config.json")
SPX="/" SPX="/"
# 保存新的 state.env # 保存新的 state.env
@@ -273,16 +274,25 @@ EOF
# 卸载 Sing-box # 卸载 Sing-box
uninstall_singbox() { uninstall_singbox() {
printf "${CYAN}===== 卸载 Sing-box =====${NC}\n" printf "${CYAN}===== 卸载 Sing-box =====${NC}\n"
# 停止并禁用服务
systemctl stop sing-box.service 2>/dev/null || true systemctl stop sing-box.service 2>/dev/null || true
systemctl disable sing-box.service 2>/dev/null || true systemctl disable sing-box.service 2>/dev/null || true
rm -rf "$CONFIG_DIR" systemctl daemon-reload
if command -v apt-get &>/dev/null; then
apt-get remove -y sing-box # 删除服务文件
elif command -v yum &>/dev/null; then rm -f /etc/systemd/system/sing-box.service
yum remove -y sing-box
elif command -v pacman &>/dev/null; then # 删除配置目录
pacman -Rss --noconfirm sing-box rm -rf /etc/singbox
fi rm -rf /etc/sing-box
# 删除 Sing-box 可执行文件
rm -f /usr/bin/sing-box
# 删除 env 文件
rm -f /etc/sing-box/state.env
printf "${GREEN}卸载完成。${NC}\n" printf "${GREEN}卸载完成。${NC}\n"
} }