You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

19 lines
407 B

require 'resolv'
module CryptCheck
module Tls
module Smtp
def self.analyze(hostname, port = 25)
srv = ::Resolv::DNS.new.getresources(hostname, ::Resolv::DNS::Resource::IN::MX)
.sort_by &:preference
hosts = if srv.empty?
[hostname]
else
srv.collect { |s| s.exchange.to_s }
end
Tls.aggregate hosts.collect { |h| Host.new h, port }
end
end
end
end