Skip to content

Commit 53ce0dc

Browse files
authored
fix: resolve failure to update server IP in sb -d
fix: 修复 sb -d 服务端 IP 修改失败的问题
1 parent 6bb22b3 commit 53ce0dc

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

sing-box.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -860,13 +860,12 @@ change_config() {
860860
[[ ! "$NEW_VAL" =~ ^([0-9]{1,3}\.){3}[0-9]{1,3}$ ]] && [[ ! "$NEW_VAL" =~ ^[0-9a-fA-F:]+$ ]] && error " $(text 133) "
861861
fi
862862

863-
864863
# 批量替换,更换服务IP和指纹不需重启服务
865864
[[ ! "$KEY" =~ ^(fingerprint|serverip|cdn)$ ]] && hint " $(text 112) "
866865

867866
if [[ "$KEY" =~ ^(serverip|cdn)$ ]]; then
868867
# IP 在配置里出现的形式有多种,逐一替换
869-
find ${WORK_DIR} -type f | xargs -P 50 sed -i -e "s|\"server\": \"${OLD}\"|\"server\": \"${NEW_VAL}\"|g" 2>/dev/null
868+
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
870869

871870
# 同时更新 subscribe/list 等文本文件中可能出现的裸 IP
872871
find ${WORK_DIR}/subscribe -type f | xargs -P 50 sed -i "s|${OLD}|${NEW_VAL}|g" 2>/dev/null

0 commit comments

Comments
 (0)