class Whois::Server::Adapters::Arin

Arin Adapter

Provides ability to query Arin WHOIS interfaces.

Public Instance Methods

request(string) click to toggle source

Executes a WHOIS query to the Arin WHOIS interface, resolving any intermediate referral, and appends the response to the client buffer.

@param [String] string @return [void]

# File lib/whois/server/adapters/arin.rb, line 28
def request(string)
  response = query_the_socket("n + #{string}", host)
  buffer_append response, host

  if options[:referral] != false && (referral = extract_referral(response))
    response = query_the_socket(string, referral[:host], referral[:port])
    buffer_append(response, referral[:host])
  end
end

Private Instance Methods

extract_referral(response) click to toggle source
# File lib/whois/server/adapters/arin.rb, line 40
def extract_referral(response)
  return unless response =~ /ReferralServer:\s*r?whois:\/\/([\w.-]+)(?::(\d+))?/
  {
    host: $1,
    port: $2 ? $2.to_i : nil
  }
end