mafintosh / dns-packet

An abstract-encoding compliant module for encoding / decoding DNS packets

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is it possible to encode/decode the `type` with IANA dna parameter?

PupilTong opened this issue · comments

Hi there,
I'm trying to use the dns-packet for some dns-over-https things...
I'm wondering if it's possible to encode/decode the type with IANA dna parameter?
https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4
like getting type:28 instead of type:'AAAA' while encode/decode?
Thanks!

You can download those assignments as a CSV file and create a dictionary mapping before making queries in dns-packet. If there’s enough interest, an alternate API could be added. What’s the use case?

Thanks! I gues a map will be enough.
This cloudflare document shows that for json format doh response, the type field will be number.
https://developers.cloudflare.com/1.1.1.1/encrypted-dns/dns-over-https/make-api-requests/dns-json
I'm trying to implement a dns proxy from classic dns to doh services, and pick a answer from answers based on phisical distance of answers' ip.