dat-ecosystem-archive / DEPs

Dat Enhancement Proposals. Contains all specs for the Dat protocol, including drafts. [ DEPRECATED - see https://github.com/hypercore-protocol/hypercore-proposals for similar functionality. More info on active projects and modules at https://dat-ecosystem.org/ ]
https://dat-ecosystem.github.io/DEPs
166 stars 17 forks source link

Allow for other key=value pairs in a dat TXT record #62

Closed ryanramage closed 4 years ago

ryanramage commented 4 years ago

Currently, the implementation of the dat TXT record has a very greedy regex that only allows for a datkey=value

I am working on an app that uses dat, but also needs to store extra key values in the same TXT record. The proposal is to relax the regex slights, so that a datkey could be mixed with other key values in the same TXT record.

In my case the TXT record would look like:

datkey=3390cfcc601a97174f1221aa7277e0e5b49e5f3e973e4edecac0c66791c882c4;l=53.52294522577663,-113.30244317650795

But I am not proposing what the delimiters will be in any way. And I would not recommend any delimiters. Leave that part flexible.

So I have put together a pull request that relaxes the regex slightly, and would allow for other use cases of the same TXT record. No delimiters are specified, and all current TXT records would function fine.

https://github.com/datprotocol/dat-dns/pull/19#issuecomment-524503841

pfrazee commented 4 years ago

Okay that's interesting. Could you tell me a little more about what information you're putting in the record?

RangerMauve commented 4 years ago

Seems to be storing latitude / longitude info in DNS records for this project

ryanramage commented 4 years ago

In my case I need to store a lat/lon coord in the same txt record as @RangerMauve pointed out.

I am working on way for organizations to use dns + dat to publish geojson information. So for example a city wants to manage and publish its neighbourhoods. something like

oliver.neighbourhoods.edmonton.ca mccauley.neighbourhoods.edmonton.ca

each DNS has a TXT record that looks like

datkey=3390cfcc601a97174f1221aa7277e0e5b49e5f3e973e4edecac0c66791c882c4;l=53.52294522577663,-113.30244317650795

The lat/lon is the center point, and the datkey specifies a way to get the full geojson shape of the neighbourhood. the geojson would be at dat://3390cfcc601a97174f1221aa7277e0e5b49e5f3e973e4edecac0c66791c882c4/oliver.neighbourhoods.edmonton.ca

Some consumers of the text record are just interested in the point itself, while some want both.

I have wrestled with having 2 TXT records, but this is not supported by all nameservers. A lot of text records use delimiters in their entries to allow more than one key value. (see DMARC https://en.wikipedia.org/wiki/TXT_record#Example_usage)

Basically a small relaxation of what dat is looking for would allow for some flexibility. It allows the current standard usage, and allows some flexibility for use cases such as mine.

pfrazee commented 4 years ago

Okay that makes sense. Let me talk it through with the folks (we'll bring it up at the WG this wednesday) and see if anybody has opinions about this.

pfrazee commented 4 years ago

Okay WG is 👍 for this. We'll merge the dat-dns PR. Would you mind also creating a PR for https://github.com/datprotocol/DEPs/blob/master/proposals/0005-dns.md ?

ryanramage commented 4 years ago

fantastic, I will create a PR as advised.

pfrazee commented 4 years ago

Thanks!

pfrazee commented 4 years ago

👍 Published 4.0.2