From 73e3e04d7e4125e01f75d817a5af12cc26155895 Mon Sep 17 00:00:00 2001 From: Olia Lisa Date: Tue, 19 May 2026 10:29:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/update_port.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/bin/update_port.sh b/bin/update_port.sh index f3fefec..39f68f4 100644 --- a/bin/update_port.sh +++ b/bin/update_port.sh @@ -156,6 +156,22 @@ port_manage() { fi } + +# ========================================== +# 更新 sing-box 配置文件中的监听端口,并开放对应防火墙规则 +# 参数1: 端口号(可选,不传则在指定范围内随机选取空闲端口) +# 参数2: 随机端口起始值(可选,默认 5000) +# 参数3: 随机端口结束值(可选,默认 15000) +# --- 使用示例 --- +# 指定端口 +# update_port 8080 +# +# 自动随机端口(默认范围 5000-15000) +# update_port +# +# 自动随机端口(自定义范围) +# update_port "" 20000 30000 +# ========================================== update_port(){ local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # 脚本文件夹绝对路径