2017-09-12 17:05:40 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Amp\Dns\Record;
|
|
|
|
|
|
|
|
require __DIR__ . "/../vendor/autoload.php";
|
|
|
|
|
2019-01-25 02:27:47 +01:00
|
|
|
function pretty_print_records(string $queryName, array $records)
|
|
|
|
{
|
|
|
|
print "---------- " . $queryName . " " . \str_repeat("-", 55 - \strlen($queryName)) . " TTL --\r\n";
|
2017-09-12 17:05:40 +02:00
|
|
|
|
|
|
|
$format = "%-10s %-56s %-5d\r\n";
|
|
|
|
|
|
|
|
foreach ($records as $record) {
|
2019-01-25 02:27:47 +01:00
|
|
|
print \sprintf($format, Record::getName($record->getType()), $record->getValue(), $record->getTtl());
|
2017-09-12 17:05:40 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-25 02:27:47 +01:00
|
|
|
function pretty_print_error(string $queryName, \Throwable $error)
|
|
|
|
{
|
|
|
|
print "-- " . $queryName . " " . \str_repeat("-", 70 - \strlen($queryName)) . "\r\n";
|
|
|
|
print \get_class($error) . ": " . $error->getMessage() . "\r\n";
|
2017-09-12 17:05:40 +02:00
|
|
|
}
|