https://github.com/spider-gazelle/dns
extensible non blocking DNS for crystal lang
https://github.com/spider-gazelle/dns
Last synced: 26 days ago
JSON representation
extensible non blocking DNS for crystal lang
- Host: GitHub
- URL: https://github.com/spider-gazelle/dns
- Owner: spider-gazelle
- License: mit
- Created: 2024-10-22T01:06:02.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-10-23T21:08:32.000Z (6 months ago)
- Last Synced: 2024-10-24T10:57:02.053Z (6 months ago)
- Language: Crystal
- Size: 58.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- trackawesomelist - dns (⭐9) - DNS protocol implementation and resolver (Recently Updated / [Apr 02, 2025](/content/2025/04/02/README.md))
- awesome-crystal - dns - DNS protocol implementation and resolver (Network Protocols)
README
# DNS
Non-blocking extendable DNS client for crystal lang.
With built in support for UDP, TLS, HTTPS and mDNS resolvers
## Installation
1. Add the dependency to your `shard.yml`:
```yaml
dependencies:
dns:
github: spider-gazelle/dns
```2. Run `shards install`
## Usage
A simple query
```crystal
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)
```crystal
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
```
## Contributing
1. Fork it ()
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request## Contributors
- [Stephen von Takach](https://github.com/stakach) - creator and maintainer