class

IP2Country

Inherits Reference / Object

Constants

CACHE_DIR = (File.expand_path(File.dirname(File.dirname("/tmp/tmp.mJnpci/src/src/ip2country.cr")))) + "/cache"
LANGS = Set.new(["en", "fr", "de", "es", "pt", "ja", "ko", "zh"])
REGISTRARS = {"ARIN" => "http://ftp.arin.net/pub/stats/arin/delegated-arin-extended-latest", "RIPE" => "https://ftp.ripe.net/pub/stats/ripencc/delegated-ripencc-extended-latest", "APNIC" => "https://ftp.apnic.net/stats/apnic/delegated-apnic-extended-latest", "LACNIC" => "http://ftp.lacnic.net/pub/stats/lacnic/delegated-lacnic-extended-latest", "AFRINIC" => "http://ftp.afrinic.net/pub/stats/afrinic/delegated-afrinic-extended-latest"}
VERSION = "0.1.4"

Constructors

new(default_lang : String = "en")
Source

Class methods

cache_update
Source

Instance methods

country_code(addr : String) : String
Source
country_code(addr : IPAddr) : String
Source
lookup(addr : String, lang : String = @default_lang) : String
Source
lookup(addr : IPAddr, lang : String = @default_lang) : String
Source
lookup_all(addr : String) : Hash(String, String)
Source
lookup_all(addr : IPAddr) : Hash(String, String)
Source

Nested types