test/examples/geoip-dns.rb in rubydns-0.8.1 vs test/examples/geoip-dns.rb in rubydns-0.8.4

- old
+ new

@@ -33,23 +33,19 @@ # This daemon requires the file downloaded from http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz # For more information, please see http://www.maxmind.com/en/geolite and http://geoip.rubyforge.org class GeoIPDNSDaemon < Process::Daemon - # You can specify a specific directory to use for run-time information (pid, logs, etc): - # @@base_directory = File.expand_path("../", __FILE__) - # @@base_directory = "/var" - Name = Resolv::DNS::Name IN = Resolv::DNS::Resource::IN R = RubyDNS::Resolver.new(RubyDNS::System::nameservers) GEO = GeoIP.new(File.expand_path('../GeoLiteCountry.dat', __FILE__)) def startup RubyDNS::run_server(:listen => INTERFACES) do match(//, IN::A) do |transaction| location = nil - peer = transaction.options[:peer] + peer = transaction.options[:connection].peername[0] if peer logger.debug "Looking up geographic information for peer #{peer}" location = GEO.country(peer[0]) end