Class: Whois::Server::Adapters::Standard

Inherits:
Base
  • Object
show all
Defined in:
lib/whois/server/adapters/standard.rb

Overview

Standard Adapter

Provides ability to query standard WHOIS interfaces. A standard WHOIS interface accepts socket requests containing the name of the domain and returns a single response containing the record for given query.

a = Standard.new(:tld, ".it", "whois.nic.it")
a.request("example.it")

By default, WHOIS interfaces listen on port 43. This adapter also supports an optional port number.

a = Standard.new(:tld, ".it", "whois.nic.it", :port => 20)
a.request("example.it")"

Options

The following options can be supplied to customize the creation of a new instance:

  • :port - Specifies a port number different than 43

Constant Summary

Constants inherited from Base

Base::DEFAULT_BIND_HOST, Base::DEFAULT_WHOIS_PORT

Instance Attribute Summary

Attributes inherited from Base

#allocation, #buffer, #host, #options, #type

Instance Method Summary collapse

Methods inherited from Base

#==, #configure, #initialize, #lookup, #query_handler

Constructor Details

This class inherits a constructor from Whois::Server::Adapters::Base

Instance Method Details

#request(string) ⇒ void

This method returns an undefined value.

Executes a WHOIS query to the WHOIS interface listening at host and appends the response to the client buffer.

The standard port of a WHOIS request is 43. You can customize it by passing a :port option.

Parameters:

  • string (String)


52
53
54
55
# File 'lib/whois/server/adapters/standard.rb', line 52

def request(string)
  response = query_the_socket(string, host)
  buffer_append response, host
end