# File lib/geoip.rb, line 488
    def country(hostname)
        if (@databaseType == GEOIP_CITY_EDITION_REV0 ||
            @databaseType == GEOIP_CITY_EDITION_REV1)
            return city(hostname)
        end

        ip = hostname
        if ip.kind_of?(String) && ip !~ /^[0-9.]*$/
            # Lookup IP address, we were given a name
            ip = IPSocket.getaddress(hostname)
        end

        # Convert numeric IP address to an integer
        ipnum = iptonum(ip)
        if (@databaseType != GEOIP_COUNTRY_EDITION && 
            @databaseType != GEOIP_PROXY_EDITION &&
            @databaseType != GEOIP_NETSPEED_EDITION)
            throw "Invalid GeoIP database type, can't look up Country by IP"
        end
        code = seek_record(ipnum) - COUNTRY_BEGIN;
        [   hostname,                   # Requested hostname
            ip,                         # Ip address as dotted quad
            code,                       # GeoIP's country code
            CountryCode[code],          # ISO3166-1 code
            CountryCode3[code],         # ISO3166-2 code
            CountryName[code],          # Country name, per IS03166
            CountryContinent[code] ]    # Continent code.
    end