Sha256: 4d8aa5d7d3813741f17c943dd8e5d514ba2ccb5a0a0ccb4ab4dc92f49a3549f4
Contents?: true
Size: 492 Bytes
Versions: 1
Compression:
Stored size: 492 Bytes
Contents
require "reversed/version" require "net/dns" require "public_suffix" module Reversed def self.lookup(ip) ip = ip.to_s unless ip.empty? resolver = Net::DNS::Resolver.new(retry: 3).search(ip) answer = resolver.answer.first || resolver.authority.first if answer hostname = answer.value.split(" ").first[0..-2] { domain: PublicSuffix.domain(hostname, ignore_private: true), hostname: hostname } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
reversed-0.1.1 | lib/reversed.rb |