Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use standard Resolv library instead of net/dns

  • Loading branch information...
commit db00e9db463cecc802954b5144ef9e3063685f3f 1 parent 65fa0f2
@purcell authored
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
Please sign in to comment.
Something went wrong with that request. Please try again.