In Ruby, I use Resolv::DNS to do this. Is there a Crystal Library or Shard do to this? I’ve spent hours searching and reading source code, even down into LibC.
For the Socket::Addrinfo class, there seems to be no way to specify the record name (A, AA, CNAME, MX, TXT, etc), and only returns the A record. If I specify a “service” of “smtp” or 25 (for email), it returns the A record for the domain instead of the MX record address (which identifies the server to send email to):
Socket::Addrinfo.tcp(“example.com”, “smtp”).inspect #=> IP Address of A record
Thanks in advance!