https://github.com/fastruby/donas
A simple gem to find DNS information for a domain
https://github.com/fastruby/donas
Last synced: 5 months ago
JSON representation
A simple gem to find DNS information for a domain
- Host: GitHub
- URL: https://github.com/fastruby/donas
- Owner: fastruby
- License: mit
- Created: 2016-04-10T22:02:13.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-04-29T01:41:10.000Z (over 9 years ago)
- Last Synced: 2025-07-07T16:05:16.162Z (6 months ago)
- Language: Ruby
- Size: 8.79 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Donas
Easily find DNS details for a domain or subdomain: Name servers, MX records, IP resolution.
## Installation
With Bundler:
```ruby
gem 'donas'
```
Without Bundler:
```bash
gem install donas
```
## Usage
### Command Line
If you want to use the command line tool:
```bash
$ donas ombushop.com
Domain: ombushop.com
IP: 50.16.228.254
Name servers:
ns-1222.awsdns-24.org
ns-2028.awsdns-61.co.uk
ns-38.awsdns-04.com
ns-779.awsdns-33.net
MX records:
1 aspmx.l.google.com
10 aspmx2.googlemail.com
10 aspmx3.googlemail.com
5 alt1.aspmx.l.google.com
5 alt2.aspmx.l.google.com
```
If you want to use it in your application:
### DNS Records
This will return A, TXT, NS and CNAME records.
```ruby
> Donas.a_record "www.ombushop.com"
=> #, @ttl=59>
> Donas.get_record "ombulabs.com"
=> #, @ttl=59>
> Donas.get_record "shop.ombulabs.com"
=> #, @ttl=21277>
> Donas.get_records "ombushop.com"
=> [#, @ttl=3599>, #, @ttl=21599>, #, @ttl=21599>, #, @ttl=21599>, #, @ttl=21599>, #, @rname=#, @serial=1, @refresh=7200, @retry=900, @expire=1209600, @minimum=86400, @ttl=899>, #, @ttl=299>, #, @ttl=299>, #, @ttl=299>, #, @ttl=299>, #, @ttl=299>, #, #, #]
```
### IP Addresses
This will return an IP address, even if the initial record is a CNAME.
```ruby
> Donas.get_address "shop.ombulabs.com"
=> #
```
### MX Records
This will return the MX records for a domain.
```ruby
> Donas.mx_records "ombulabs.com"
=> [#, @ttl=3599>, #, @ttl=3599>, #, @ttl=3599>, #, @ttl=3599>, #, @ttl=3599>]
```
### Name Servers
This will return the name servers for the main domain (even if you provide a subdomain)
```ruby
> Donas.nameservers "ombulabs.com"
=> [#, @ttl=21599>, #, @ttl=21599>, #, @ttl=21599>, #, @ttl=21599>]
```
### Summary of a Domain
This will return MX and name records.
```ruby
> Donas.summary "ombulabs.com"
=> {:nameservers=>[#, @ttl=21599>, #, @ttl=21599>, #, @ttl=21599>, #, @ttl=21599>], :mx_records=>[#, @ttl=3599>, #, @ttl=3599>, #, @ttl=3599>, #, @ttl=3599>, #, @ttl=3599>]}
```
## Development
After checking out the repo, run `bin/setup` to install dependencies.
Then, run `rake` to run the tests.
You can also run `bin/console` for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/ombulabs/donas. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
## License
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).