Class: DNSServer

Inherits:
Object
  • Object
show all
Defined in:
lib/yodel/command/dns_server.rb

Class Method Summary collapse

Class Method Details

.startObject



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/yodel/command/dns_server.rb', line 4

def self.start
  @resolv = Resolv::DNS.new
  RubyDNS::run_server(:listen => [[:udp, "0.0.0.0", Yodel.config.dns_port], [:tcp, "0.0.0.0", Yodel.config.dns_port]]) do
    match(/yodel/) do |match_data, transaction|
      transaction.respond!("127.0.0.1")
    end

    otherwise do |transaction|
      transaction.passthrough!(@resolv)
    end
  end
end