Class: Explorer::Server::DNS
- Inherits:
-
RubyDNS::Server
- Object
- RubyDNS::Server
- Explorer::Server::DNS
- Defined in:
- lib/explorer/server/dns.rb
Instance Method Summary collapse
-
#initialize(port) ⇒ DNS
constructor
A new instance of DNS.
- #process(name, resource_class, transaction) ⇒ Object
Constructor Details
#initialize(port) ⇒ DNS
Returns a new instance of DNS.
6 7 8 9 |
# File 'lib/explorer/server/dns.rb', line 6 def initialize(port) super listen: interfaces(port) async.run end |
Instance Method Details
#process(name, resource_class, transaction) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/explorer/server/dns.rb', line 11 def process(name, resource_class, transaction) return transaction.fail!(:NXDomain) unless name_matches?(name) if resource_class == Resolv::DNS::Resource::IN::A transaction.respond!('127.0.0.1') elsif resource_class == Resolv::DNS::Resource::IN::AAAA transaction.respond!('::1') else transaction.fail!(:NXDomain) end end |