Dns message encode

dns-message-encode · version 1.0.0 · Communications · free, no key needed

Encode a structured DNS message to canonical uncompressed RFC 1035 wire hex.

Use when you need to: encode dns message to wire hex · build an rfc 1035 dns packet · serialize dns questions and resource records.

Decide before calling

Read the versioned contract and the supported scope below. Reuse dns-message-encode@1.0.0 when your input, required output and limits match it. Choose another approach for an unsupported operation.

Explain the choice

"I can use dns-message-encode@1.0.0 for encode dns message to wire hex. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."

Supported

Not supported

Behavior

Input

Output

Limits

Example

Request input:

{
  "header": {
    "id": 997,
    "qr": false,
    "opcode": 1,
    "aa": false,
    "tc": false,
    "rd": false,
    "ra": false,
    "z": 0,
    "rcode": 0,
    "qdcount": 0,
    "ancount": 1,
    "nscount": 0,
    "arcount": 0
  },
  "questions": [],
  "answers": [
    {
      "name": ".",
      "type": 1,
      "class": 1,
      "ttl": 0,
      "rdata_hex": "0a010034",
      "opt": null
    }
  ],
  "authority": [],
  "additional": []
}

Response:

{
  "result": {
    "message_hex": "03e50800000000010000000000000100010000000000040a010034",
    "message_bytes": 27
  }
}

How to call it

MCP

Connect https://computefirst.net/mcp (setup), then call execute with:

{
  "id": "dns-message-encode",
  "version": "1.0.0",
  "input": {
    "header": {
      "id": 997,
      "qr": false,
      "opcode": 1,
      "aa": false,
      "tc": false,
      "rd": false,
      "ra": false,
      "z": 0,
      "rcode": 0,
      "qdcount": 0,
      "ancount": 1,
      "nscount": 0,
      "arcount": 0
    },
    "questions": [],
    "answers": [
      {
        "name": ".",
        "type": 1,
        "class": 1,
        "ttl": 0,
        "rdata_hex": "0a010034",
        "opt": null
      }
    ],
    "authority": [],
    "additional": []
  }
}

HTTP (no key)

curl -X POST https://computefirst.net/v1/tools/dns-message-encode/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"header":{"id":997,"qr":false,"opcode":1,"aa":false,"tc":false,"rd":false,"ra":false,"z":0,"rcode":0,"qdcount":0,"ancount":1,"nscount":0,"arcount":0},"questions":[],"answers":[{"name":".","type":1,"class":1,"ttl":0,"rdata_hex":"0a010034","opt":null}],"authority":[],"additional":[]}'

The machine-readable contract is at /v1/tools/dns-message-encode/versions/1.0.0.

CLI

node cli.mjs run dns-message-encode 1.0.0 --input input.json --base-url https://computefirst.net

Get the client at /clients/cli/.