summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Flatz2022-06-27 11:02:07 +0200
committerDavid Flatz2022-06-27 11:02:07 +0200
commit68ba08463aa38e9b02d81ed70f3bd06eff776ba5 (patch)
tree5279e9b613dc8794c3e0a566c22d1c325bde1e53
parentc8327bdc857ea26ec576d5c5d1070dcfd815c033 (diff)
downloaditools-68ba08463aa38e9b02d81ed70f3bd06eff776ba5.tar.gz
itools-68ba08463aa38e9b02d81ed70f3bd06eff776ba5.tar.bz2
itools-68ba08463aa38e9b02d81ed70f3bd06eff776ba5.zip
suppress errors of dns_get_record but retry to maybe work around temporary problems
-rw-r--r--it.class11
1 files changed, 7 insertions, 4 deletions
diff --git a/it.class b/it.class
index e634d44..5797e75 100644
--- a/it.class
+++ b/it.class
@@ -443,10 +443,13 @@ static function is_private_ip($host)
else
{
$ips = [];
- foreach (dns_get_record($host, DNS_A) as $record)
- $ips[] = $record['ip'];
- foreach (dns_get_record($host, DNS_AAAA) as $record)
- $ips[] = $record['ipv6'];
+ foreach ([DNS_A, DNS_AAAA] as $type)
+ {
+ $records = false;
+ for ($try = 0; $try < 3 && $records === false; $try++)
+ foreach ((array)($records = @dns_get_record($host, $type)) as $record)
+ $ips[] = $record[$type == DNS_A ? 'ip' : 'ipv6'];
+ }
}
foreach ($ips as $ip)