-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustom-config.php
39 lines (32 loc) · 1.01 KB
/
custom-config.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php declare(strict_types=1);
require __DIR__ . "/_bootstrap.php";
use Amp\Dns;
use Amp\DoH;
$customConfigLoader = new class implements Dns\DnsConfigLoader {
public function loadConfig(): Dns\DnsConfig
{
$hosts = (new Dns\HostLoader)->loadHosts();
return new Dns\DnsConfig([
"8.8.8.8:53",
"[2001:4860:4860::8888]:53",
], $hosts);
}
};
// Set default resolver to DNS-over-https resolver
$DohConfig = new DoH\DoHConfig(
[
new DoH\DoHNameserver('https://daniil.it/dns-query'),
new DoH\DoHNameserver('https://mozilla.nonexistant-dns.com/dns-query'),
new DoH\DoHNameserver('https://mozilla.cloudflare-dns.com/dns-query'), // Will fallback to this
],
null,
null,
$customConfigLoader
);
Dns\dnsResolver(new DoH\Rfc8484StubDoHResolver($DohConfig));
$hostname = $argv[1] ?? "amphp.org";
try {
pretty_print_records($hostname, Dns\resolve($hostname));
} catch (Dns\DnsException $e) {
pretty_print_error($hostname, $e);
}