DNS SRV Records
Sean Conner
sean at conman.org
Fri May 15 22:32:51 BST 2020
It was thus said that the Great solderpunk once stated:
> On Fri, May 15, 2020 at 05:40:58PM +0000, colecmac at protonmail.com wrote:
> > Hello!
> >
> > DNS SRV records are pretty interesting, but in my opinion this would
> > unnecessarily complicate the spec.
>
> I don't think this would necessarily need to clutter up the main spec -
> this is a "companion spec" kind of thing, like robots.txt or other
> things like that.
Kind of. One issue is: given the URL:
gemini://gemini.example.com/
does that mean a client has to look up the SRV RR for 'gemini.example.com'
before defaulting to port 1965? Also, it's not like there can only be one
SRV RR for a given service. Hypothetically, a client could get this back:
P W port host
-------------------------------------------------------------
_gemini._tcp.example.net. IN SRV 10 1 1965 backupserver3.example.net.
IN SRV 0 0 1965 server3.example.net.
IN SRV 0 5000 1965 server1.example.net.
IN SRV 10 2 1966 backupserver2.example.net.
IN SRV 10 3 1967 backupserver1.example.net.
IN SRV 5 0 1965 redundant1.example.net.
IN SRV 0 1000 1965 server2.example.net.
IN SRV 0 5000 5691 server3.example.net.
IN SRV 5 0 1965 redundant2.example.net.
IN SRV 5 0 2020 redundant3.example.net.
P = priority - lower values first
W = weight - higher values first
A client would need to sort the list based upon priority (lower first),
then by weight (higher first), then pick a server at random among those with
the same priority and weight. So according to this list, a client would
have to first attempt to contact
pick one at random
server1.example.net:1965
server3.example.net:6591
and last
backupserver3.example.net:1965
It's all spelled out in RFC-2782 [1].
Is this a pathological case? Yes. Will most SRV records have one entry?
Probably, but that's a gut feeling, I don't have actual numbers to look at.
And unlike looking up an A or AA RR with the "standard" POSIX function
getaddrinfo(), there is not simple API that I am aware of for the SRV RR.
Also, an SRV RR query might require a second A/AAAA RR lookup [2].
-spc (Just some things to keep in mind ... )
[1] Shameless plug---I wote a DNS library in C:
https://github.com/spc476/SPCDNS
Yeah, that's why I know this stuff.
[2] Depends upon the DNS server. Some will return the answer along with
additional records to avoid further queries, some won't.
More information about the Gemini
mailing list