Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Json output #32

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft

Json output #32

wants to merge 8 commits into from

Conversation

tertsdiepraam
Copy link
Contributor

@tertsdiepraam tertsdiepraam commented Jun 21, 2024

Here's some example output (still WIP and suggestions are welcome):

Custom JSON format

> dnsi query nlnetlabs.nl --format=json
{
  "message": {
    "id": 62706,
    "qr": true,
    "opcode": "QUERY",
    "qdcount": 1,
    "ancount": 1,
    "nscount": 0,
    "arcount": 1,
    "question": {
      "name": "nlnetlabs.nl.",
      "type": "AAAA",
      "class": "IN"
    },
    "answer": [
      {
        "owner": "nlnetlabs.nl",
        "class": "IN",
        "type": "AAAA",
        "ttl": 240,
        "data": {
          "AAAA": {
            "addr": "2a01:4f8:c0c:cdfa::1"
          }
        }
      },
      {
        "owner": "nlnetlabs.nl.",
        "class": "IN",
        "type": "AAAA",
        "ttl": 240,
        "data": {
          "AAAA": {
            "addr": "2a01:4f8:c0c:cdfa::1"
          }
        }
      }
    ],
    "authority": [],
    "additional": [
      {
        "owner": ".",
        "class": "CLASS1232",
        "type": "OPT",
        "ttl": 0,
        "data": {
          "OPT": []
        }
      }
    ]
  },
  "stats": {
    "start": "2024-06-25T10:52:55.834028711+02:00",
    "duration": 22,
    "server_addr": "9.9.9.9:53",
    "server_proto": "UDP"
  }
}

RFC 8427 format

> dnsi query nlnetlabs.nl --format=rfc8427
{
  "dateString": "2024-06-25T10:54:10+02:00",
  "dateSeconds": 1719305650,
  "msgLength": 69,
  "ID": 5004,
  "QR": 1,
  "Opcode": 0,
  "AA": 0,
  "TC": 0,
  "RD": 1,
  "RA": 1,
  "AD": 0,
  "CD": 0,
  "RCODE": 0,
  "QDCOUNT": 1,
  "ANCOUNT": 1,
  "NSCOUNT": 0,
  "ARCOUNT": 1,
  "QNAME": "nlnetlabs.nl",
  "QTYPE": 28,
  "QTYPEname": "AAAA",
  "QCLASS": 1,
  "QCLASSname": "IN",
  "questionRRs": [
    {
      "TYPE": 28,
      "TYPEname": "AAAA",
      "CLASS": 1,
      "CLASSname": "IN"
    }
  ],
  "answerRRs": [
    {
      "NAME": "nlnetlabs.nl.",
      "TYPE": 28,
      "TYPEname": "AAAA",
      "CLASS": 1,
      "CLASSname": "IN",
      "TTL": 240,
      "rdataAAAA": "2a01:4f8:c0c:cdfa::1",
      "RDLENGTH": 16,
      "RDATAHEX": "2A0104F80C0CCDFA0000000000000001"
    }
  ],
  "authorityRRs": [],
  "additionalRRs": [],
  "EDNS": {
    "version": 0,
    "flags": [],
    "rcode": "NOERROR",
    "udpsize": 512
  }
}

@tertsdiepraam
Copy link
Contributor Author

This now requires some changes in domain: NLnetLabs/domain#343, so we might need to wait for a release there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant