test/examples/geoip-dns.rb in rubydns-0.7.3 vs test/examples/geoip-dns.rb in rubydns-0.8.0

- old
+ new

@@ -18,40 +18,34 @@ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -require 'rubygems' - require 'geoip' -require 'rexec' -require 'rexec/daemon' +require 'process-daemon' -require 'rubygems' require 'rubydns' - -require 'rubydns/resolver' require 'rubydns/system' INTERFACES = [ [:udp, "0.0.0.0", 5300] ] # 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 < RExec::Daemon::Base +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 self.run + def startup RubyDNS::run_server(:listen => INTERFACES) do match(//, IN::A) do |transaction| location = nil peer = transaction.options[:peer]