Dns rdata encode
dns-rdata-encode · version 1.0.0 · Communications · free, no key needed
Encode DNS RDATA for A, AAAA, NS, CNAME, PTR, MX, TXT, SOA, SRV, or unknown hex.
Use when you need to: encode dns rdata wire · dns record fields to rdata hex · build wire for dns a aaaa mx txt soa srv.
Decide before calling
Read the versioned contract and the supported scope below. Reuse dns-rdata-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-rdata-encode@1.0.0 for encode dns rdata wire. 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
- encode dns rdata wire
- dns record fields to rdata hex
- build wire for dns a aaaa mx txt soa srv
- dns presentation to uncompressed rdata
- encode a dns resource record rdata
- turn dns record data into octets
- קידוד נתוני רשומת דיאן אס
Not supported
- query DNS or resolve a hostname
- compress a domain name against a DNS message
- split a TXT string longer than 255 octets into chunks
- validate DNSSEC signatures
Behavior
- Structured rr_type is one of A, AAAA, NS, CNAME, PTR, MX, TXT, SOA, SRV. rr_class is a pinned mnemonic (IN, CS, CH, HS, NONE, ANY, or *). ANY is an alias of *.
- Domain names are absolute, end with an unescaped dot, and are encoded uncompressed. Each label is at most 63 octets. The whole name, including length octets and the root, is at most 255 octets (RFC 1035 sections 2.3.4 and 3.1). A longer name is invalid_input, including when it follows MX or SRV fixed fields.
- A is canonical dotted-decimal IPv4 with no leading zeros. AAAA accepts RFC 4291 text (one :: and an optional final dotted IPv4 tail, no zone id) and the wire is 16 octets.
- TXT chunks are printable ASCII octet strings, with \\ , \. and \DDD escapes. Each chunk is 0 to 255 octets and at least one chunk is required. Chunks are not auto-split.
- MX preference and SRV priority, weight and port are integers 0 to 65535. SOA serial, refresh, retry, expire and minimum are integers 0 to 4294967295. All multi-byte integers are big-endian.
- An unknown rr_type_code (not one of the nine structured types) copies lowercase rdata_hex through unchanged. A structured type code in that form is invalid_input.
- Class is recorded with its pinned code and does not alter RDATA octets. No DNS query is sent.
- More than 262144 UTF-8 bytes of JSON input, more than 65535 RDATA octets, more than 4096 TXT chunks, or a name or chunk above its character cap is limit_exceeded before the rest of the parse.
- Disclaimer: format transform only; provides no confidentiality, integrity, or authenticity.
Input
rr_type(one of "A", "AAAA", "NS", "CNAME", "PTR", "MX", "TXT", "SOA", "SRV", optional)rr_class(one of "IN", "CS", "CH", "HS", "NONE", "ANY", "*", optional)rr_type_code(integer, optional): min 0; max 65535ipv4(string, optional): min length 7; max length 15ipv6(string, optional): min length 2; max length 45domain_name(string, optional): min length 1; max length 2048preference(integer, optional): min 0; max 65535exchange(string, optional): min length 1; max length 2048txt_chunks(array of string, optional): min items 1; max items 4096; each min length 0; each max length 2048mname(string, optional): min length 1; max length 2048rname(string, optional): min length 1; max length 2048serial(integer, optional): min 0; max 4294967295refresh(integer, optional): min 0; max 4294967295retry(integer, optional): min 0; max 4294967295expire(integer, optional): min 0; max 4294967295minimum(integer, optional): min 0; max 4294967295priority(integer, optional): min 0; max 65535weight(integer, optional): min 0; max 65535port(integer, optional): min 0; max 65535target(string, optional): min length 1; max length 2048rdata_hex(string, optional): min length 0; max length 131070; pattern^([0-9a-f]{2})*$
Output
data_version(constant "iana-dns-parameters-2026-10-21", required)rr_type(string or null, required): min length 1; max length 12rr_type_code(integer, required): min 0; max 65535rr_class(string, required): min length 1; max length 4rr_class_code(integer, required): min 0; max 65535wire_known(boolean, required)rdata_length(integer, required): min 0; max 65535rdata_hex(string, required): min length 0; max length 131070; pattern^([0-9a-f]{2})*$
Limits
- max input bytes: 262144
- max rdata bytes: 65535
- max txt chunks: 4096
- max domain chars: 2048
- max txt chunk chars: 2048
Example
Request input:
{
"rr_type": "A",
"rr_class": "IN",
"ipv4": "192.0.2.1"
}
Response:
{
"result": {
"data_version": "iana-dns-parameters-2026-10-21",
"rr_type": "A",
"rr_type_code": 1,
"rr_class": "IN",
"rr_class_code": 1,
"wire_known": true,
"rdata_length": 4,
"rdata_hex": "c0000201"
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "dns-rdata-encode",
"version": "1.0.0",
"input": {
"rr_type": "A",
"rr_class": "IN",
"ipv4": "192.0.2.1"
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/dns-rdata-encode/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"rr_type":"A","rr_class":"IN","ipv4":"192.0.2.1"}'
The machine-readable contract is at /v1/tools/dns-rdata-encode/versions/1.0.0.
CLI
node cli.mjs run dns-rdata-encode 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Dns rdata decode: Decode DNS RDATA hex for A, AAAA, NS, CNAME, PTR, MX, TXT, SOA, SRV, or unknown.
- Dns message encode: Encode a structured DNS message to canonical uncompressed RFC 1035 wire hex.
- Dns type code lookup: Look up a pinned DNS RR type mnemonic or its numeric code.
- Dns message parse: Parse a DNS message hex string into the RFC 1035 header, questions, and resource records.
- Dns message validate: Validate DNS message hex structure: counts, names, compression, and OPT records.
- Email address list format: Format mailboxes and groups as one deterministic RFC 5322 address-list.