Sha256: 7c71369cf587cc426e362aa40e7b2ba5375f73050e1011f296a560a87aa067a1

Contents?: true

Size: 649 Bytes

Versions: 1

Compression:

Stored size: 649 Bytes

Contents

require 'mastodon_healthchecker/dns_records'
require 'mastodon_healthchecker/instance_info'
require 'mastodon_healthchecker/version'

module MastodonHealthchecker
  Result = Struct.new('Result', :exists_record, :up, :info)

  def self.perform(host)
    records = DNSRecords.new(host)
    info_v4 = InstanceInfo.fetch(host, records.v4_addresses) if records.v4_addresses.any?
    info_v6 = InstanceInfo.fetch(host, records.v6_addresses) if records.v6_addresses.any?

    Result.new(
      { v4: records.v4_addresses.any?, v6: records.v6_addresses.any? },
      { v4: !info_v4.nil?, v6: !info_v6.nil? },
      info_v4 || info_v6 || nil
    )
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mastodon_healthchecker-0.1.0.pre.2 lib/mastodon_healthchecker.rb