add timeout attribute

This commit is contained in:
yggverse 2024-04-06 11:35:40 +03:00
parent a57028f609
commit 1e5b42d407
2 changed files with 3 additions and 3 deletions

View file

@ -53,7 +53,7 @@ class Dig
);
}
public static function records(string $hostname, array $records, array &$result = [], array &$error = [], ?string $provider = null): array
public static function records(string $hostname, array $records, array &$result = [], array &$error = [], ?string $provider = null, int $timeout = 5): array
{
if (self::isProvider($provider))
{
@ -69,7 +69,7 @@ class Dig
{
if (self::isRecord($record))
{
if ($values = exec(sprintf('dig %s %s %s +short', (string) $provider, (string) $record, (string) $hostname)))
if ($values = exec(sprintf('dig %s %s %s +short +time=%d', (string) $provider, $record, $hostname, $timeout)))
{
foreach (explode(PHP_EOL, $values) as $value)
{