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:
authormhsanaei <ho3ein.sanaei@gmail.com>2025-07-06 12:22:36 +0300
committermhsanaei <ho3ein.sanaei@gmail.com>2025-07-06 21:45:58 +0300
commitbbdeb65291ff6b2f4e55fb2056928e2a23621bd7 (patch)
tree6af9403e887d078601ba6fa9b294b201445feb9e /x-ui.sh
parent038cf34219ed6f7ad2fcdc6497d527de031989d1 (diff)
new alternative to get public IP address
Diffstat (limited to 'x-ui.sh')
-rw-r--r--x-ui.sh10
1 files changed, 8 insertions, 2 deletions
diff --git a/x-ui.sh b/x-ui.sh
index 84e1b612..1ce85f91 100644
--- a/x-ui.sh
+++ b/x-ui.sh
@@ -249,7 +249,10 @@ check_config() {
local existing_webBasePath=$(echo "$info" | grep -Eo 'webBasePath: .+' | awk '{print $2}')
local existing_port=$(echo "$info" | grep -Eo 'port: .+' | awk '{print $2}')
local existing_cert=$(/usr/local/x-ui/x-ui setting -getCert true | grep -Eo 'cert: .+' | awk '{print $2}')
- local server_ip=$(curl -s https://api.ipify.org)
+ local server_ip=$(curl -s --max-time 3 https://api.ipify.org)
+ if [ -z "$server_ip" ]; then
+ server_ip=$(curl -s --max-time 3 https://4.ident.me)
+ fi
if [[ -n "$existing_cert" ]]; then
local domain=$(basename "$(dirname "$existing_cert")")
@@ -1630,7 +1633,10 @@ remove_iplimit() {
}
SSH_port_forwarding() {
- local server_ip=$(curl -s https://api.ipify.org)
+ local server_ip=$(curl -s --max-time 3 https://api.ipify.org)
+ if [ -z "$server_ip" ]; then
+ server_ip=$(curl -s --max-time 3 https://4.ident.me)
+ fi
local existing_webBasePath=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'webBasePath: .+' | awk '{print $2}')
local existing_port=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'port: .+' | awk '{print $2}')
local existing_listenIP=$(/usr/local/x-ui/x-ui setting -getListen true | grep -Eo 'listenIP: .+' | awk '{print $2}')