How do I lookup DNS MX, TXT, etc. records?

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!

1 Like

https://shards.info/search?query=dns
https://crystalshards.org/shards/search?q=dns
https://shardbox.org/search?q=dns

Refer to Crystal Shards, Tools and Tutorials

HIH

2 Likes

Thank you again! I saw that shard discovery section, but thought they were all like “awesome shards”. Now I am illuminated, and found a shard to use!

2 Likes