# File lib/geoip.rb, line 640 def isp(hostname) 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_ISP_EDITION throw "Invalid GeoIP database type, can't look up Organization/ISP by IP" end pos = seek_record(ipnum); record = "" @mutex.synchronize { @file.seek(pos + (2*@record_length-1) * @databaseSegments[0]) record = @file.read(MAX_ORG_RECORD_LENGTH) } record = record.sub(/\000.*/, '') record end