From 53ce0dc541de2114a0d1e72f1c6b319ed1e0e2e1 Mon Sep 17 00:00:00 2001 From: fscarmen <62703343+fscarmen@users.noreply.github.com> Date: Thu, 25 Jun 2026 09:55:07 +0800 Subject: [PATCH] fix: resolve failure to update server IP in sb -d MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix: 修复 sb -d 服务端 IP 修改失败的问题 --- sing-box.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sing-box.sh b/sing-box.sh index a0c9650..35425e4 100644 --- a/sing-box.sh +++ b/sing-box.sh @@ -860,13 +860,12 @@ change_config() { [[ ! "$NEW_VAL" =~ ^([0-9]{1,3}\.){3}[0-9]{1,3}$ ]] && [[ ! "$NEW_VAL" =~ ^[0-9a-fA-F:]+$ ]] && error " $(text 133) " fi - # 批量替换,更换服务IP和指纹不需重启服务 [[ ! "$KEY" =~ ^(fingerprint|serverip|cdn)$ ]] && hint " $(text 112) " if [[ "$KEY" =~ ^(serverip|cdn)$ ]]; then # IP 在配置里出现的形式有多种,逐一替换 - find ${WORK_DIR} -type f | xargs -P 50 sed -i -e "s|\"server\": \"${OLD}\"|\"server\": \"${NEW_VAL}\"|g" 2>/dev/null + find ${WORK_DIR} -type f | xargs -P 50 sed -i -e "s|\"server\": \"${OLD}\"|\"server\": \"${NEW_VAL}\"|g; s|\"WS_SERVER_IP_SHOW\": \"${OLD}\"|\"WS_SERVER_IP_SHOW\": \"${NEW_VAL}\"|g" 2>/dev/null # 同时更新 subscribe/list 等文本文件中可能出现的裸 IP find ${WORK_DIR}/subscribe -type f | xargs -P 50 sed -i "s|${OLD}|${NEW_VAL}|g" 2>/dev/null