From b21f1e00d84cd964a4d78f241ca729fd9375d71f Mon Sep 17 00:00:00 2001 From: buildplan Date: Mon, 24 Nov 2025 15:37:19 +0000 Subject: [PATCH] collect config improvements --- du_setup.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/du_setup.sh b/du_setup.sh index 20f6e76..9e62fa9 100644 --- a/du_setup.sh +++ b/du_setup.sh @@ -2820,8 +2820,17 @@ collect_config() { if validate_port "$SSH_PORT" || [[ -n "$PREVIOUS_SSH_PORT" && "$SSH_PORT" == "$PREVIOUS_SSH_PORT" ]]; then break; else print_error "Invalid port. Choose a port between 1024-65535."; fi done - SERVER_IP_V4=$(curl -4 -s https://ifconfig.me 2>/dev/null || echo "unknown") - SERVER_IP_V6=$(curl -6 -s https://ifconfig.me 2>/dev/null || echo "not available") + print_info "Detecting server IP addresses..." + SERVER_IP_V4=$(curl -4 -s --connect-timeout 4 --max-time 5 https://ifconfig.me 2>/dev/null || \ + curl -4 -s --connect-timeout 4 --max-time 5 https://ip.me 2>/dev/null || \ + curl -4 -s --connect-timeout 4 --max-time 5 https://icanhazip.com 2>/dev/null || \ + echo "unknown") + + SERVER_IP_V6=$(curl -6 -s --connect-timeout 4 --max-time 5 https://ifconfig.me 2>/dev/null || \ + curl -6 -s --connect-timeout 4 --max-time 5 https://ip.me 2>/dev/null || \ + curl -6 -s --connect-timeout 4 --max-time 5 https://icanhazip.com 2>/dev/null || \ + echo "not available") + if [[ "$SERVER_IP_V4" != "unknown" ]]; then print_info "Detected server IPv4: $SERVER_IP_V4" fi