|
@@ -3,6 +3,7 @@
|
|
require 'eventmachine'
|
|
require 'eventmachine'
|
|
require 'digest/md5'
|
|
require 'digest/md5'
|
|
require 'fiber'
|
|
require 'fiber'
|
|
|
|
+require 'geoip'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -258,8 +259,11 @@ module InterconnectionPointProtocolHandler
|
|
rest = $3
|
|
rest = $3
|
|
|
|
|
|
if iphost =~ /^\d+\.\d+\.\d+\.\d+/
|
|
if iphost =~ /^\d+\.\d+\.\d+\.\d+/
|
|
- # resolve it to a dns name
|
|
|
|
|
|
+ # find country code
|
|
|
|
+ c = GeoIP.new('GeoIP.dat').country(iphost)[3].to_s.downcase
|
|
|
|
+ rest << "(#{c})" unless c.nil?
|
|
|
|
|
|
|
|
+ # resolve it to a dns name
|
|
f = Fiber.new do
|
|
f = Fiber.new do
|
|
Fiber.yield Resolv.getname(iphost)
|
|
Fiber.yield Resolv.getname(iphost)
|
|
end
|
|
end
|
|
@@ -273,6 +277,7 @@ module InterconnectionPointProtocolHandler
|
|
# if the resulting dns has too many dots, use ip-address instead.
|
|
# if the resulting dns has too many dots, use ip-address instead.
|
|
if host_name.length > 23 || host_name.split(".").size >= 4
|
|
if host_name.length > 23 || host_name.split(".").size >= 4
|
|
#put_log "cutting down host_name #{host_name} #{host_name.size} #{host_name.split(".").size}"
|
|
#put_log "cutting down host_name #{host_name} #{host_name.size} #{host_name.split(".").size}"
|
|
|
|
+
|
|
host_name = iphost
|
|
host_name = iphost
|
|
end
|
|
end
|
|
end
|
|
end
|