diff options
author | David Flatz | 2022-06-27 11:02:07 +0200 |
---|---|---|
committer | David Flatz | 2022-06-27 11:02:07 +0200 |
commit | 68ba08463aa38e9b02d81ed70f3bd06eff776ba5 (patch) | |
tree | 5279e9b613dc8794c3e0a566c22d1c325bde1e53 | |
parent | c8327bdc857ea26ec576d5c5d1070dcfd815c033 (diff) | |
download | itools-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.class | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -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) |