mirror of
https://github.com/YGGverse/net-php.git
synced 2026-03-31 17:15:35 +00:00
add timeout attribute
This commit is contained in:
parent
a57028f609
commit
1e5b42d407
2 changed files with 3 additions and 3 deletions
|
|
@ -40,7 +40,7 @@ var_dump(
|
||||||
|
|
||||||
```
|
```
|
||||||
var_dump(
|
var_dump(
|
||||||
\Yggverse\Net\Dig::records('yo.index', ['A', 'AAAA'], &$result = [], &$error = [], $provider = null)
|
\Yggverse\Net\Dig::records('yo.index', ['A', 'AAAA'], &$result = [], &$error = [], $provider = null, $timeout = 5)
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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))
|
if (self::isProvider($provider))
|
||||||
{
|
{
|
||||||
|
|
@ -69,7 +69,7 @@ class Dig
|
||||||
{
|
{
|
||||||
if (self::isRecord($record))
|
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)
|
foreach (explode(PHP_EOL, $values) as $value)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue