Skip to content

Commit

Permalink
Use standard Resolv library instead of net/dns
Browse files Browse the repository at this point in the history
  • Loading branch information
purcell committed Aug 30, 2012
1 parent 65fa0f2 commit db00e9d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 0 additions & 2 deletions Gemfile
Expand Up @@ -2,5 +2,3 @@ source 'http://rubygems.org'
source 'http://gems.github.com'

gem 'whois'
gem 'net-dns'

8 changes: 5 additions & 3 deletions bin/postfix-policy-whois
Expand Up @@ -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

Expand Down

0 comments on commit db00e9d

Please sign in to comment.