问题
I want to create a test DNS server in ruby, but could not find anything suitable. I found pnet-dns(http://rubyforge.org/projects/pnet-dns/). This project is incomplete and buggy. Is there any alternative?
回答1:
A language-agnostic alternative is to use PowerDNS pipe backend. Because it communicates with a name server across a simple pipe, it can be written in any language, including Ruby. (The simple example in the documentation uses Perl but it should be easy to translate.)
回答2:
RubyDNS is what you're looking for.
回答3:
Checkout an another approach of DNS server in ruby using celluloid: https://github.com/celluloid/celluloid-dns
The original celluloid-dns
is horribly incomplete (v0.0.1). Recently, RubyDNS is being copied into celluloid-dns
(I'm doing this as we speak). RubyDNS will be modified to work with the updated celluloid-dns
since all core functions will be moved from RubyDNS to celluloid-dns
.
If you want something that works right now, use RubyDNS. However, in the future, if you just want the low level APIs, use celluloid-dns
.
回答4:
Have you looked at Dnsruby?
It aims to be fully RFC compliant, although it focuses primarily on the client side. It is, however, possible to write your own server - use Dnsruby::Message#decode
to decode incoming packets, and a zone of RRSets holding your test records. You can then encode your packets to send back to the client.
来源:https://stackoverflow.com/questions/852123/is-there-a-good-dns-server-library-in-ruby