测试LDNET-API

This commit is contained in:
CN-JS-HuiBai
2026-02-08 23:07:13 +08:00
parent ebdf2b4f27
commit 1d74935ebd

View File

@@ -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