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