Sha256: e733025384275a319ef2f41d2799efbadd6e6ffc4ff10bd98965ef60f578ab26

Contents?: true

Size: 502 Bytes

Versions: 7

Compression:

Stored size: 502 Bytes

Contents

require 'resolv'

module MastodonHealthchecker
  class DNSRecords
    def initialize(host)
      @v4_addresses = []
      @v6_addresses = []
      Resolv::DNS.new.each_address(host) do |addr|
        case addr
        when Resolv::IPv4
          v4_addresses << addr
        when Resolv::IPv6
          v6_addresses << addr
        else
          raise "Resolver returns an address which is neither IPv4 nor IPv6."
        end
      end
    end

    attr_reader :v4_addresses, :v6_addresses
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mastodon_healthchecker-0.1.0.pre.8 lib/mastodon_healthchecker/dns_records.rb
mastodon_healthchecker-0.1.0.pre.7 lib/mastodon_healthchecker/dns_records.rb
mastodon_healthchecker-0.1.0.pre.6 lib/mastodon_healthchecker/dns_records.rb
mastodon_healthchecker-0.1.0.pre.5 lib/mastodon_healthchecker/dns_records.rb
mastodon_healthchecker-0.1.0.pre.4 lib/mastodon_healthchecker/dns_records.rb
mastodon_healthchecker-0.1.0.pre.3 lib/mastodon_healthchecker/dns_records.rb
mastodon_healthchecker-0.1.0.pre.2 lib/mastodon_healthchecker/dns_records.rb