Sha256: 84110bf80d273f8aa27686a260023e8279abafdb424599282762b5cd949b413b

Contents?: true

Size: 1.41 KB

Versions: 1

Compression:

Stored size: 1.41 KB

Contents

#!/usr/bin/env ruby

$:.unshift File.join(File.dirname(__FILE__), %w{.. lib})
require 'globetrotter'
require 'trollop'

opts = Trollop.options do
  opt :ns_count_to_check,
      'How many nameservers to query',
      type: Integer,
      default: 100,
      short: '-c'
  opt :ns_max_age_minutes,
      'Query nameservers validated <= this many minutes ago',
      type: Integer,
      default: 60,
      short: '-a'
  opt :query,
      'Hostname to lookup',
      type: String,
      default: 'googleapis.com'
  opt :timeout_seconds,
      'Seconds to wait before queries timeout',
      type: Integer,
      default: 2,
      short: '-t'
  opt :concurrency,
      'Number of concurrent DNS requests to make',
      type: Integer,
      default: 100,
      short: '-p'
end

ns_count_to_check = opts.ns_count_to_check
ns_max_age_minutes = opts.ns_max_age_minutes
timeout_seconds = opts.timeout_seconds
concurrency = opts.concurrency
query = opts.query

Trollop.die :ns_count_to_check, 'must be positive' if ns_count_to_check < 0
Trollop.die :ns_max_age_minutes, 'must be positive' if ns_max_age_minutes < 0
Trollop.die :timeout_seconds, 'must be positive' if ns_max_age_minutes < 0
Trollop.die :concurrency, 'must be positive' if ns_max_age_minutes < 0

gt = Globetrotter.new(
  query: query,
  ns_count_to_check: ns_count_to_check,
  ns_max_age_minutes: ns_max_age_minutes,
  timeout_seconds: timeout_seconds,
  concurrency: concurrency
)
gt.run

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
globetrotter-0.0.4 bin/globetrotter