Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'install.sh')
-rw-r--r--install.sh7
1 files changed, 5 insertions, 2 deletions
diff --git a/install.sh b/install.sh
index 852e128a..46207777 100644
--- a/install.sh
+++ b/install.sh
@@ -654,8 +654,11 @@ config_after_install() {
)
local server_ip=""
for ip_address in "${URL_lists[@]}"; do
- server_ip=$(curl -s --max-time 3 "${ip_address}" 2>/dev/null | tr -d '[:space:]')
- if [[ -n "${server_ip}" ]]; then
+ local response=$(curl -s -w "\n%{http_code}" --max-time 3 "${ip_address}" 2>/dev/null)
+ local http_code=$(echo "$response" | tail -n1)
+ local ip_result=$(echo "$response" | head -n-1 | tr -d '[:space:]')
+ if [[ "${http_code}" == "200" && -n "${ip_result}" ]]; then
+ server_ip="${ip_result}"
break
fi
done