Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
147 lines (116 sloc) 3.06 KB
[This is the description of the JSON output format produced by the
*current* code. A work is going on at the IETF to specify a
DNS-in-JSON format
<http://tools.ietf.org/html/draft-bortzmeyer-dns-json>. The tool and
the IETF document may not agree at every moment.]
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."}}