mirror of
https://github.com/danog/dns.git
synced 2025-01-22 13:31:12 +01:00
Niklas Keller
2c8133a7b4
Allow empty domain names to be decoded
This is a rather long standing issue. LibDNS didn't allow to decode empty domain names. Empty domain names were previously only observed with PTR records, but were now also observed in regular queries in authoritative records that include the root nameservers. LibDNS 2.0 mainly adds scalar types has just a few breaking changes. We don't expose it anywhere, so an upgrade is perfectly fine. Fixes #53.
dns
amphp/dns
provides asynchronous DNS name resolution for Amp.
Installation
composer require amphp/dns
Example
<?php
require __DIR__ . '/vendor/autoload.php';
use Amp\Dns;
use Amp\Loop;
Loop::run(function () {
$githubIpv4 = yield Dns\resolve("github.com", Dns\Record::A);
var_dump($githubIpv4);
$googleIpv4 = Amp\Dns\resolve("google.com", Dns\Record::A);
$googleIpv6 = Amp\Dns\resolve("google.com", Dns\Record::AAAA);
$firstGoogleResult = yield Amp\Promise\first([$googleIpv4, $googleIpv6]);
var_dump($firstGoogleResult);
$combinedGoogleResult = yield Amp\Dns\resolve("google.com");
var_dump($combinedGoogleResult);
$googleMx = yield Amp\Dns\query("google.com", Amp\Dns\Record::MX);
var_dump($googleMx);
});
Languages
PHP
98.6%
Makefile
1.4%