测试LDNET-API
This commit is contained in:
@@ -27,8 +27,10 @@ TARGET="/tmp/node_exporter.tar.gz"
|
|||||||
is_cn=false
|
is_cn=false
|
||||||
|
|
||||||
echo "Detecting geographic location..."
|
echo "Detecting geographic location..."
|
||||||
|
API_URL="https://ipinfo.littlediary.cn/info"
|
||||||
|
JSON=$(curl -s --max-time 5 "$API_URL")
|
||||||
|
COUNTRY=$(echo "$JSON" | grep -o '"country":"[^"]*"' | cut -d'"' -f4)
|
||||||
|
|
||||||
COUNTRY=$(curl -s --max-time 3 https://ipinfo.io/country || true)
|
|
||||||
if [ "$COUNTRY" = "CN" ]; then
|
if [ "$COUNTRY" = "CN" ]; then
|
||||||
is_cn=true
|
is_cn=true
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user