alviy
7 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
16 additions and
20 deletions
-
dnsapi/dns_alviy.sh
|
@ -103,11 +103,10 @@ dns_alviy_rm() { |
|
|
_get_root() { |
|
|
_get_root() { |
|
|
domain=$1 |
|
|
domain=$1 |
|
|
i=2 |
|
|
i=2 |
|
|
p=1 |
|
|
|
|
|
while true; do |
|
|
|
|
|
h=$(printf "%s" "$domain" | rev | cut -d . -f 1-2 | rev) |
|
|
h=$(printf "%s" "$domain" | rev | cut -d . -f 1-2 | rev) |
|
|
if [ -z "$h" ]; then |
|
|
if [ -z "$h" ]; then |
|
|
#not valid |
|
|
#not valid |
|
|
|
|
|
_debug "can't get host from $domain" |
|
|
return 1 |
|
|
return 1 |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
@ -118,13 +117,10 @@ _get_root() { |
|
|
if _contains "$response" '"code":"NOT_FOUND"'; then |
|
|
if _contains "$response" '"code":"NOT_FOUND"'; then |
|
|
_debug "$h not found" |
|
|
_debug "$h not found" |
|
|
else |
|
|
else |
|
|
_sub_domain=$(printf "%s" "$domain" | cut -d . -f 1-$p) |
|
|
|
|
|
|
|
|
_sub_domain=$(printf "%s" "$domain" | rev | cut -d . -f 3- | rev) |
|
|
_domain="$h" |
|
|
_domain="$h" |
|
|
return 0 |
|
|
return 0 |
|
|
fi |
|
|
fi |
|
|
p="$i" |
|
|
|
|
|
i=$(_math "$i" + 1) |
|
|
|
|
|
done |
|
|
|
|
|
return 1 |
|
|
return 1 |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|