class Ryo::Plugin::DNS

Constants

TYPES

Attributes

domain[R]

Public Class Methods

discover(domain) click to toggle source
# File lib/ryo/plugin/dns.rb, line 36
def self.discover(domain)
  new(domain).discover
end
new(domain) click to toggle source
# File lib/ryo/plugin/dns.rb, line 9
def initialize(domain)
  @domain = domain
end

Public Instance Methods

dig(type) click to toggle source
# File lib/ryo/plugin/dns.rb, line 22
def dig(type)
  params = { name: domain, type: type }
  body = fetch_body(params)
  JSON.parse(body)
end
discover() click to toggle source
# File lib/ryo/plugin/dns.rb, line 28
def discover
  h = {}
  TYPES.each do |type|
    h[type] = dig(type)
  end
  h
end
endpoint() click to toggle source
# File lib/ryo/plugin/dns.rb, line 13
def endpoint
  "https://dns.google.com/resolve"
end
fetch_body(params) click to toggle source
# File lib/ryo/plugin/dns.rb, line 17
def fetch_body(params)
  res = Client.http.get(endpoint, params: params)
  res.body.to_s
end