1 | <?php |
||
14 | class Dns |
||
15 | { |
||
16 | /** @var string */ |
||
17 | protected $domain; |
||
18 | |||
19 | /** @var string */ |
||
20 | protected $nameserver; |
||
21 | |||
22 | /** @var array */ |
||
23 | protected $result; |
||
24 | |||
25 | /** @var string */ |
||
26 | protected $defaultNameserver = '8.8.8.8'; |
||
27 | |||
28 | /** @var float */ |
||
29 | protected $timeout = 3.0; |
||
30 | |||
31 | /** @var array */ |
||
32 | protected $recordTypes = [ |
||
33 | 'A' => Message::TYPE_A, |
||
34 | 'CAA' => Message::TYPE_CAA, |
||
35 | 'CNAME' => Message::TYPE_CNAME, |
||
36 | 'SOA' => Message::TYPE_SOA, |
||
37 | 'TXT' => Message::TYPE_TXT, |
||
38 | 'MX' => Message::TYPE_MX, |
||
39 | 'AAAA' => Message::TYPE_AAAA, |
||
40 | 'SRV' => Message::TYPE_SRV, |
||
41 | 'NS' => Message::TYPE_NS, |
||
42 | 'PTR' => Message::TYPE_PTR, |
||
43 | 'SSHFP' => Message::TYPE_SSHFP, |
||
44 | ]; |
||
45 | |||
46 | public static function for(string $domain, string $nameserver = ''): self |
||
50 | |||
51 | public function __construct(string $domain, string $nameserver = '') |
||
57 | |||
58 | public function useNameserver(string $nameserver): self |
||
64 | |||
65 | public function allowedRecordTypes(): array |
||
69 | |||
70 | protected function resolveNameserver(string $nameserver): string |
||
74 | |||
75 | protected function sanitizeDomain(string $domain): string |
||
85 | |||
86 | /** |
||
87 | * @param string|array ...$types |
||
88 | * |
||
89 | * @return array |
||
90 | */ |
||
91 | public function records(...$types): array |
||
119 | |||
120 | protected function addResult(string $type, array $values): void |
||
138 | |||
139 | protected function resolveTypes(array $types = []): array |
||
159 | |||
160 | public function getNameserver(): string |
||
164 | |||
165 | public function getDomain(): string |
||
169 | } |
||
170 |