cr-dns
dns
Work In Progress - This is not yet a usable library
Features:
- Basic server and resolver functionality over TCP and UDP (not yet standards compliant)
- Zone file reader
- Currently supported Resource Records: A, CNAME, MX, NS, PTR, SOA, and TXT
- Partially supported Resource Records: AAAA, HINFO, and OPT
- Simple DNS response caching
Installation
Add this to your application's shard.yml
:
dependencies:
dns:
github: teknomunk/cr-dns
Usage
Client
require "dns"
resolv = DNS::Resolver.new( DNS::Resolver::TCPChannel.new( "127.0.0.0", 5353 ) )
resolv.send_request( DNS::Message.simple_query( "A", "example.com." ) )
msg = resolv.get_response()
if msg.answers.size > 0 && (rr=msg.answers[0]).is_a?(DNS::RR::A)
puts rr.ip_address
end
Server
require "dns"
server = DNS::Server.new()
server.listen_udp( "0.0.0.0", 5353 )
server.listen_tcp( "0.0.0.0", 5353 )
server.add_zone( DNS::Zone.new( File.open("test.zone") ) )
server.run()
Contributing
- Fork it (https://github.com/teknomunk/cr-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
Contributors
- teknomunk teknomunk - creator, maintainer
Repository
cr-dns
Owner
Statistic
- 13
- 2
- 1
- 0
- 1
- over 6 years ago
- October 13, 2018
License
MIT License
Links
Synced at
Sun, 18 May 2025 04:51:28 GMT
Languages