Class Whois::Server
In: lib/universal_ruby_whois/server.rb
Parent: Object

Whois::Server

A Whois server object represents a single TLD mapped to a whois server hostname, and a set of regular expressions that are used to match against the raw whois output and determine various information about the domain name (currently registration status is supported on most domain TLDs, and creation date on a good number).

Methods

Classes and Modules

Class Whois::Server::Unavailable

Constants

DEFAULT_WHOIS_REGULAR_EXPRESSIONS = { :free => /(avail|free|no match|no entr|not taken|not registered|not found)/im, :registered => /(registered|Domain ID|domain name\s*\:|is active|is not available|exists|\bregistrant\b|Created on)/im, :creation_date => /(Creation date|created on|created at|Commencement Date|Registration Date)\s*[\:\.\]]*\s*([\w\-\:\ \/]+)[^\n\r]*[\n\r]/im, :expiration_date => /(expiration date|expires on|registered through|Renewal date)\s*[\:\.\]]*\s*([\w\-\:\ \/]+)[^\n\r]*[\n\r]/im, :error => /(error)/im, :server_unavailable => /(Sorry\. Server busy\.|too many requests|been blocked)/im   The default regular expressions used when defining a new server if none are supplied.
WHOIS_BIN = '/usr/bin/env whois'   The location of the ‘whois’ binary utility.

Attributes

nic_server  [R] 
port  [R] 
regexes  [R] 
tld  [R] 
unavailable  [R] 
unavailable_response  [R] 

Public Class methods

Whois Server Definition

Define a whois server for one or more TLDs. TLDs can be given as a single string or an array of strings representing TLDs that are handled by this server. The second argument should be a whois server hostname. If none is given, the generic output from the command line whois program is used (with any available redirection). An optional third argument is an array of regular expressions used to parse output from this particular server. A set of relatively liberal defaults is used if none (or only some) are given. Supported regex keys are :free, :registered, :creation_date and :error.

Regex Options

  • :registered — If this regular expression matches the whois output, this domain is considered registered.
  • :free — If this regular expression matches the whois output, the domain is considered available.
  • :error — If this regular expression matches, an error is said to have occurred.
  • :creation_date — If this regular expression matches, the value of the second set of parentheses is parsed using ParseDate and used as the creation date for this domain.

Note, the preferred location for Whois::Server definitions is the server_list.rb file. Definitions should go from least specific to most specific, as subsequent definitions for a TLD will override previous ones.

Used as a fallback in case no specific WHOIS server is defined for a given TLD. An attempt will be made to search the IANA global registrar database to find a suitable whois server.

A list of strings representing all supported TLDs.

Look up a domain name. If a proper whois server can not be found for this domain name’s extension, it will return nil. Otherwise it returns a Whois::Domain object.

Note: the preferred way to call this method is through the wrapper:

  Whois.find(domain)

Find a TLD from a full domain name. There is special care to check for two part TLDs (such as .co.uk, .kids.us, etc) first and then to look for the last part alone.

A hash of all of the known whois servers indexed by TLD

Determine the appropriate whois server object for a domain name.

Public Instance methods

Retrieve the raw WHOIS server output for a domain.

[Validate]