2016-12-30 04:16:14 +01:00
|
|
|
<?php
|
2016-03-19 22:23:55 +01:00
|
|
|
|
|
|
|
namespace Amp\Dns;
|
|
|
|
|
2017-03-17 05:01:58 +01:00
|
|
|
use Amp\Promise;
|
2016-11-15 17:42:15 +01:00
|
|
|
|
2016-03-19 22:23:55 +01:00
|
|
|
interface Resolver {
|
|
|
|
/**
|
2017-06-23 13:32:04 +02:00
|
|
|
* Resolves a hostname name to an IP address [hostname as defined by RFC 3986].
|
|
|
|
*
|
|
|
|
* Upon success the returned promise resolves to an array of Record objects.
|
|
|
|
*
|
|
|
|
* A null $ttl value indicates the DNS name was resolved from the cache or the local hosts file.
|
|
|
|
*
|
|
|
|
* @param string $name The hostname to resolve.
|
|
|
|
* @param int $typeRestriction Optional type restriction to `Record::A` or `Record::AAAA`, otherwise `null`.
|
|
|
|
*
|
|
|
|
* @return Promise
|
2016-03-19 22:23:55 +01:00
|
|
|
*/
|
2017-06-23 13:14:51 +02:00
|
|
|
public function resolve(string $name, int $typeRestriction = null): Promise;
|
2016-03-19 22:23:55 +01:00
|
|
|
|
|
|
|
/**
|
2017-06-23 13:32:04 +02:00
|
|
|
* Query specific DNS records.
|
|
|
|
*
|
|
|
|
* Upon success the returned promise resolves to an array of Record objects.
|
|
|
|
*
|
|
|
|
* @param string $name Record to question, A, AAAA and PTR queries are automatically normalized.
|
|
|
|
* @param int $type Use constants of Amp\Dns\Record.
|
|
|
|
*
|
|
|
|
* @return Promise
|
2016-03-19 22:23:55 +01:00
|
|
|
*/
|
2017-06-23 09:24:26 +02:00
|
|
|
public function query(string $name, int $type): Promise;
|
2017-06-17 10:49:54 +02:00
|
|
|
}
|