SRV records
Sean Conner
sean at conman.org
Sun Jun 28 03:55:52 BST 2020
It was thus said that the Great Evert Pot once stated:
> Dear list,
>
> I would like to play around with Gemini and build a personal site. I'd
> love to be able to host it on my main domain at gemini://evertpot.com/
Okay, so you are running a service on port 1965 that *isn't* Gemini, and
you would like to run a Gemini server on a different port, but not have to
specify the port number on the URL. Okay, got it.
> It occurred to me that it would be nice if I could use DNS SRV records
> to point gemini:// clients to a different host. However, after reading
> the spec it doesn't seem like there is support for this.
>
> I would love support for this, but or that to be realistically useful,
> it would have to be in the spec and required. I know a lot of HTTP folks
> wish they had that from the start too, as it's a pain to adopt later.
Like you, I wouldn't mind seeing SRV records used more often, but there
are considerations. First off, the dismal state of DNS resolution libaries
out there. For the most part, they pretty much do too much (have their own
network driver that is hard to integrate into an existing network based
program) and do too little (very little support for non A/AAAA records---you
might get lucky and get MX support).
I was fed up enough to write my own DNS encoding/decoding library [1] but
that only helps if you use C (or Lua---I include Lua bindings in the
library) and you still need to integrate your own networking with it [3].
Second, the code needs to be aware that multiple SRV records for a given
service can exist, and how to order the results and pick one.
And the use of SRV records impact clients more than servers. Instead of
now, where a client can go:
location = breakdown(url)
address = getaddrinfo(location.host,location.port or 1965)
you now need:
results = lookup(RR_SRV,location.host)
if results then
sort(results) /* based upon priority and weight */
/* if not done by the lookup() routine */
for each result in results do
address = getaddrinfo(result.host,result.port)
if address then break
end
end
if not address then
address = getaddrinfo(location.host,location.port or 1965)
end
Keep in mind the above is "get the idea" pseudocode, not real code.
> I couldn't find in the archives if this has been asked before.
It has not.
-spc (The client now needs to know which DNS server to query, and how does
it obtain *that* information?)
[1] https://github.com/spc476/SPCDNS [2]
[2] My most popular Github project if going by stars.
[3] A lot easier than with the other DNS libraries I've come across, but
it still needs to be done.
More information about the Gemini
mailing list