mirror of
https://github.com/fscarmen/sing-box.git
synced 2026-08-10 17:55:16 +08:00
fix: resolve failure to update server IP in sb -d
fix: 修复 sb -d 服务端 IP 修改失败的问题
This commit is contained in:
+1
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user