Rfc1035StubDnsResolver
in package
implements
DnsResolver
uses
ForbidCloning, ForbidSerialization
Table of Contents
Interfaces
Constants
- CACHE_PREFIX = "amphp.dns."
- CONFIG_FAILED = 2
- CONFIG_LOADED = 1
- CONFIG_NOT_LOADED = 0
Properties
- $blockingFallbackResolver : BlockingFallbackDnsResolver
- $cache : Cache<string|int, array<int, array{string, int}>>
- $config : DnsConfig|null
- $configLoader : DnsConfigLoader
- $configStatus : int
- $gcCallbackId : string
- $nextNameserver : int
- $pendingConfig : Future|null
- $pendingQueries : array<string|int, Future>
- $pendingSockets : array<string|int, Future>
- $questionFactory : QuestionFactory
- $sockets : array<string|int, Socket>
Methods
- __construct() : mixed
- __destruct() : mixed
- __serialize() : never
- __unserialize() : never
- query() : array<int, DnsRecord>
- Query specific DNS records.
- reloadConfig() : DnsConfig
- Reloads the configuration in the background.
- resolve() : array<int, DnsRecord>
- Resolves a hostname name to an IP address [hostname as defined by RFC 3986].
- __clone() : mixed
- assertAcceptableResponse() : void
- createQuestion() : Question
- getCacheKey() : string
- getSocket() : Socket
- loadConfigIfNotLoaded() : void
- normalizeName() : string
- queryHosts() : array<int, DnsRecord>
- searchForAliasRecord() : string|null
- selectNameservers() : array<string|int, mixed>
- shouldRetry() : bool
Constants
CACHE_PREFIX
public
mixed
CACHE_PREFIX
= "amphp.dns."
CONFIG_FAILED
private
mixed
CONFIG_FAILED
= 2
CONFIG_LOADED
private
mixed
CONFIG_LOADED
= 1
CONFIG_NOT_LOADED
private
mixed
CONFIG_NOT_LOADED
= 0
Properties
$blockingFallbackResolver read-only
private
BlockingFallbackDnsResolver
$blockingFallbackResolver
$cache read-only
private
Cache<string|int, array<int, array{string, int}>>
$cache
$config
private
DnsConfig|null
$config
= null
$configLoader read-only
private
DnsConfigLoader
$configLoader
$configStatus
private
int
$configStatus
= self::CONFIG_NOT_LOADED
$gcCallbackId read-only
private
string
$gcCallbackId
$nextNameserver
private
int
$nextNameserver
= 0
$pendingConfig
private
Future|null
$pendingConfig
= null
$pendingQueries
private
array<string|int, Future>
$pendingQueries
= []
$pendingSockets
private
array<string|int, Future>
$pendingSockets
= []
$questionFactory read-only
private
QuestionFactory
$questionFactory
$sockets
private
array<string|int, Socket>
$sockets
= []
Methods
__construct()
public
__construct([Cache|null $cache = null ][, DnsConfigLoader|null $configLoader = null ]) : mixed
Parameters
- $cache : Cache|null = null
- $configLoader : DnsConfigLoader|null = null
__destruct()
public
__destruct() : mixed
__serialize()
public
final __serialize() : never
Return values
never__unserialize()
public
final __unserialize(array<string|int, mixed> $data) : never
Parameters
- $data : array<string|int, mixed>
Return values
neverquery()
Query specific DNS records.
public
query(string $name, int $type[, Cancellation|null $cancellation = null ]) : array<int, DnsRecord>
Upon success this method returns an array of Record objects. If no records of the given type are found, a DnsException is thrown.
Parameters
- $name : string
-
Record to question, A, AAAA and PTR queries are automatically normalized.
- $type : int
-
Use constants of Amp\Dns\Record.
- $cancellation : Cancellation|null = null
Return values
array<int, DnsRecord>reloadConfig()
Reloads the configuration in the background.
public
reloadConfig() : DnsConfig
Once it's finished, the configuration will be used for new requests.
Tags
Return values
DnsConfigresolve()
Resolves a hostname name to an IP address [hostname as defined by RFC 3986].
public
resolve(string $name[, int|null $typeRestriction = null ][, Cancellation|null $cancellation = null ]) : array<int, DnsRecord>
Upon success this method returns an array of Record objects. If the domain cannot be resolved, a DnsException is thrown.
A null $ttl value indicates the DNS name was resolved from the cache or the local hosts file.
Parameters
- $name : string
-
The hostname to resolve.
- $typeRestriction : int|null = null
-
Optional type restriction to
Record::AorRecord::AAAA, otherwisenull. - $cancellation : Cancellation|null = null
Return values
array<int, DnsRecord>__clone()
protected
final __clone() : mixed
assertAcceptableResponse()
private
assertAcceptableResponse(Message $response, string $name) : void
Parameters
- $response : Message
- $name : string
Tags
createQuestion()
private
createQuestion(string $name, int $type) : Question
Parameters
- $name : string
- $type : int
Return values
QuestiongetCacheKey()
private
getCacheKey(string $name, int $type) : string
Parameters
- $name : string
- $type : int
Return values
stringgetSocket()
private
getSocket(string $uri) : Socket
Parameters
- $uri : string
Return values
SocketloadConfigIfNotLoaded()
private
loadConfigIfNotLoaded() : void
normalizeName()
private
normalizeName(string $name, int $type) : string
Parameters
- $name : string
- $type : int
Return values
stringqueryHosts()
private
queryHosts(string $name[, int|null $typeRestriction = null ]) : array<int, DnsRecord>
Parameters
- $name : string
- $typeRestriction : int|null = null
Return values
array<int, DnsRecord>searchForAliasRecord()
private
searchForAliasRecord(string $searchName, Cancellation|null $cancellation) : string|null
Parameters
- $searchName : string
- $cancellation : Cancellation|null
Return values
string|nullselectNameservers()
private
selectNameservers() : array<string|int, mixed>
Return values
array<string|int, mixed>shouldRetry()
private
shouldRetry(int|string $code) : bool
Parameters
- $code : int|string