dns-lg/JSON.txt

148 lines
3.1 KiB
Plaintext

[This is the description of the JSON output format produced by the
*current* code. A work was going on at the IETF to specify this
DNS-in-JSON format
<https://datatracker.ietf.org/doc/draft-bortzmeyer-dns-json/> but it
is now dead. Another format, slightly different, has been
standardized, in RFC 8427.]
A DNS response is represented as a JSON object. The main members of
this object (the names are self-explanatory) are:
* QuestionSection
* AnswerSection
* AdditionalSection
* AuthoritySection
* ReturnCode (NOERROR, NXDOMAIN, SERVFAIL, etc)
* ID
* AA (Authoritative Answer)
* TC (TrunCation)
* RD (Recursion Desired)
* RA (Recursion Available)
* AD (Authentic Data)
* Query
It is common to omit some of these members, to save bandwidth or by
pure lazyness. So, clients who consume this sort of JSON objects
should not assume every member is present. <- THIS IS AN IMPORTANT
RULE
The Question Section is an object with members Qname, Qtype and
Qclass.
The other three sections are JSON arrays, each DNS record is an item
in the array. They may be empty array (for instance, if the request
returns NOERROR,ANSWER=0, the AnswerSection will be an empty array).
DNS resource records are objects. The following members are common to
all record types:
* Name (owner name)
* Type
* Class
* TTL
The other members depend on the record type.
A:
* Address
AAAA:
* Address
MX:
* Preference
* MailExchanger
NS:
* Target
PTR:
* Target
CNAME:
* Target
SOA:
* MaintainerName
* MasterServerName
* Serial
* Refresh
* Retry
* Expire
* NegativeTtl
DNSKEY:
* Algorithm
* Length
* Flags
* Tag
DS:
* DelegationKey
* DigestType
DLV:
* DelegationKey
* DigestType
NSEC3PARAM:
* Algorihm
* Flags
* Salt
* Iterations
SSHFP:
* Algorithm
* DigestType
* Fingerprint
NAPTR:
* Flags
* Order
* Services
* Preference
* Regexp
* Replacement
SRV:
* Server
* Port
* Priority
* Weight
LOC:
* Longitude
* Latitude
* Altitude
SPF:
* Text
Note there is no concept of resource record sets.
The Query object has fields about the query: Time is the time of the
test, Duration is the number of seconds it took to process the
request, Server is the resolver used.
Examples:
{"Query": {"Server": "127.0.0.1"},
"AnswerSection": [
{"TTL": 6666, "Type": "AAAA", "Address": "2a03:2880:10:8f01:face:b00c::25"},
{"TTL": 6666, "Type": "AAAA", "Address": "2a03:2880:2110:3f01:face:b00c::"},
{"TTL": 6666, "Type": "AAAA", "Address": "2a03:2880:10:1f02:face:b00c::25"}],
"ReturnCode": "NOERROR"}
{"Query": {"Server": "127.0.0.1"},
"AnswerSection": [
{"TTL": 397, "Type": "AAAA", "Name": "web.nic.fr.", "Address": "2001:660:3003:2::4:20"}],
"ReturnCode": "NOERROR",
"QuestionSection": {"Qtype": "AAAA", "Qname": "www.afnic.fr."}}
{"Query": {"Server": "127.0.0.1"},
"AnswerSection": [
{"Name": "bortzmeyer.fr.", "MasterServerName": "ns3.bortzmeyer.org.", "MaintainerName": "hostmaster.bortzmeyer.org.", "TTL": 3600, "Serial": 2012060801, "Type": "SOA"}],
"ReturnCode": "NOERROR",
"AD": true,
"QuestionSection": {"Qtype": "SOA", "Qname": "bortzmeyer.fr."}}