improve performance and memory usage for dns_anx

when fetching all zones the memory usage can exceede limits and also
cause timeouts.

with this change the zone will be searched via the longest to shortest
match using the get endpoint.
pull/5187/head
René Weselowski 2024-06-26 14:09:44 +02:00
parent 0d8a314bcf
commit 89586530a5
1 changed files with 1 additions and 2 deletions

View File

@ -127,8 +127,6 @@ _get_root() {
i=1 i=1
p=1 p=1
_anx_rest GET "zone.json"
while true; do while true; do
h=$(printf "%s" "$domain" | cut -d . -f $i-100) h=$(printf "%s" "$domain" | cut -d . -f $i-100)
_debug h "$h" _debug h "$h"
@ -137,6 +135,7 @@ _get_root() {
return 1 return 1
fi fi
_anx_rest GET "zone.json/${h}"
if _contains "$response" "\"name\":\"$h\""; then if _contains "$response" "\"name\":\"$h\""; then
_sub_domain=$(printf "%s" "$domain" | cut -d . -f 1-$p) _sub_domain=$(printf "%s" "$domain" | cut -d . -f 1-$p)
_domain=$h _domain=$h