Skip to content
Browse files

Use standard Resolv library instead of net/dns

  • Loading branch information...
1 parent 65fa0f2 commit db00e9db463cecc802954b5144ef9e3063685f3f @purcell committed
Showing with 5 additions and 5 deletions.
  1. +0 −2 Gemfile
  2. +5 −3 bin/postfix-policy-whois
View
2 Gemfile
@@ -2,5 +2,3 @@ source 'http://rubygems.org'
source 'http://gems.github.com'
gem 'whois'
-gem 'net-dns'
-
View
8 bin/postfix-policy-whois
@@ -2,12 +2,14 @@
$0='postfix-policy-registrar'
-require 'net/dns'
+require 'resolv'
require 'whois'
def nameserver_for(domain)
- if answer = Net::DNS::Resolver.start(domain, Net::DNS::NS).answer.first
- answer.nsdname.sub(/\.$/, '')
+ begin
+ Resolv::DNS.new.getresource(domain, Resolv::DNS::Resource::IN::NS).name.to_s
+ rescue Resolv::ResolvError
+ nil
end
end

0 comments on commit db00e9d

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