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

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

Open
phnoe27 opened this issue Apr 29, 2024 · 4 comments
Open

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

phnoe27 opened this issue Apr 29, 2024 · 4 comments

Comments

@phnoe27
Copy link

phnoe27 commented Apr 29, 2024

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
Copy link
Member

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
Copy link
Member

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
Copy link
Author

phnoe27 commented Apr 30, 2024

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

@ShreyasZare
Copy link
Member

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.

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

No branches or pull requests

2 participants