Non-blocking extendable DNS client for crystal lang.
With built in support for UDP, TLS, HTTPS and mDNS resolvers
-
Add the dependency to your
shard.yml
:dependencies: dns: github: spider-gazelle/dns
-
Run
shards install
A simple query
require "dns"
responses = DNS.query(
"www.google.com",
[
DNS::RecordCode::A,
DNS::RecordCode::AAAA,
]
)
ips = responses.map(&.ip_address)
Configure for HTTPS DNS (secure from prying eyes)
require "dns"
require "dns/resolver/https"
DNS.default_resolver = DNS::Resolver::HTTPS.new(["https://1.1.1.1/dns-query"])
# or just for some routes
DNS.resolvers[/.+\.com\.au$/i] = DNS::Resolver::HTTPS.new(["https://1.1.1.1/dns-query"])
# there is a built in resolver to use mDNS for *.local routes
- Fork it (https://github.com/your-github-user/dns/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
- Stephen von Takach - creator and maintainer