TechnitiumSoftware / DnsServer

Technitium DNS Server
https://technitium.com/dns/
GNU General Public License v3.0
3.82k stars 397 forks source link

Key/Value Pairs in TXT Records (for DNS-SD RFC6763) #913

Closed phnoe27 closed 1 week ago

phnoe27 commented 1 month ago

I don't know how to add multiple key/value pairs to one TXT record. In Zonefile syntax (e.g. for BIND) it has to be something like this:

test.name.internal. TXT "api_ver=v1.0,v1.1,v1.2,v1.3" "api_proto=http" "pri=0" "api_auth=false"

But the result of "Import Zone" of this Line is: api_ver=v1.0,v1.1,v1.2,v1.3api_proto=httppri=0api_auth=false A query for this record gives api_ver as the key and the rest as value string.

How can I separate the Key/Value pairs? Thank you for your help!

ShreyasZare commented 1 month ago

Thanks for the post. There is no key/value pair concept in TXT record. The zone file syntax that you mention exists to allow defining a TXT record that is greater than 255 char in length. Each of the strings in double quotes in the syntax is an "character string" which is limited to 255 chars max. When the zone file is processed, all those strings are concatenated to form a single TXT record.

Which is why when you used the Import Zone option, the strings were concatenated since the DNS server treats the TXT record data as a single string.

If this TXT record is what you a defining yourself then you need to add a separator character, something like ; or space so that you would be able to parse the TXT response.

I hope that clears the confusion.

ShreyasZare commented 1 month ago

I missed the RFC reference in the title and it does seem that the standard uses these "character strings" thing in TXT record as a key/value pair entry.

Right now, this is not supported as it treats these separate strings as a single string. Will see how this can be implemented.

phnoe27 commented 1 month ago

Thank you for your quick reply. Please let me know when you implement this feature.

ShreyasZare commented 1 month ago

Thank you for your quick reply. Please let me know when you implement this feature.

Yes, I will post it here when its available so that you get a notification.

ShreyasZare commented 1 week ago

Technitium DNS Server v12.2.1 is now available that adds support to create TXT record with custom character-strings both from the GUI and from the Zone Import option. Do update and let me know your feedback.

phnoe27 commented 1 week ago

Both options work.

Thank you!

ShreyasZare commented 1 week ago

Thanks for the feedback!