Skip to content
Browse files

Few changes.

- give a way to avoid adding default resolvers
- add from and to accessors to Message
  • Loading branch information...
1 parent 40df135 commit cf933d6e436bc4de09a6e43994ed414502ec20ac @meh committed Feb 26, 2012
Showing with 7 additions and 2 deletions.
  1. +1 −1 lib/faildns/client.rb
  2. +1 −1 lib/faildns/message.rb
  3. +5 −0 lib/faildns/server/dispatcher/client.rb
View
2 lib/faildns/client.rb
@@ -37,7 +37,7 @@ def initialize (options = {})
end
}
- if @resolvers.empty?
+ if @resolvers.empty? && @options[:servers] != false && @options[:resolvers] != false
@resolvers << Resolver::Hosts.new
@resolvers << Resolver::DNS.new
end
View
2 lib/faildns/message.rb
@@ -104,7 +104,7 @@ def pointer_for (domain, offset)
include DNS::Comparable
- attr_accessor :header
+ attr_accessor :header, :from, :to
attr_reader :questions, :answers, :authorities, :additionals
def initialize (header = nil, *args)
View
5 lib/faildns/server/dispatcher/client.rb
@@ -26,6 +26,11 @@ def receive_data (data)
message = Message.unpack(data)
response = Message.new
+ ip = IP.new(Socket.unpack_sockaddr_in(get_peername).last)
+
+ message.from = ip
+ response.to = ip
+
dispatcher.input message, response
dispatcher.output response

0 comments on commit cf933d6

Please sign in to comment.
Something went wrong with that request. Please try again.