跳至正文
Wener Notes

DNS over HTTPS (DoH)

约 1 分钟阅读
标签:DNSHTTPS协议

Status Codes

  • 400 DNS query not specified or too small.
  • 413 DNS query is larger than maximum allowed DNS message size.
  • 415 Unsupported content type.
  • 504 Resolver timeout while waiting for the query response.

Examples

bash
# Cloudflare JSON
curl -H 'accept: application/dns-json' 'https://cloudflare-dns.com/dns-query?name=example.com&type=AAAA'
curl -H 'accept: application/dns-json' 'https://1.1.1.1/dns-query?name=example.com&type=A&do=1'

# Google JSON
curl 'https://dns.google/resolve?name=example.com&type=AAAA'
# ct=application/x-javascript 显式请求 JSON;ct=application/dns-message 则返回二进制 DNS 报文
curl 'https://dns.google/resolve?name=example.com&type=A&ct=application/x-javascript'
json
{
  "Status": 0,
  "TC": false,
  "RD": true,
  "RA": true,
  "AD": true,
  "CD": false,
  "Question": [{ "name": "example.com.", "type": 28 }],
  "Answer": [{ "name": "example.com.", "type": 28, "TTL": 1726, "data": "2606:2800:220:1:248:1893:25c8:1946" }]
}
  • Status 是 DNS RCODE:0 NOERROR,2 SERVFAIL,3 NXDOMAIN
  • type 为数字:1 A,5 CNAME,28 AAAA

关联信息

反向链接、本文链接的其他页面和外部资料。

参考资料

Wikipedia1 条
其他外链3 条
最近更新commit 80b1d5f编辑