diff --git a/broadcasts/data.go b/broadcasts/data.go index b9b858d7..a04c7820 100644 --- a/broadcasts/data.go +++ b/broadcasts/data.go @@ -49,7 +49,7 @@ func collectData() interface{} { if ok && locs.Best().LocationOrNil() != nil { loc := locs.Best() data["Location"] = &Location{ - Country: loc.Location.Country.ISOCode, + Country: loc.Location.Country.Code, Coordinates: loc.Location.Coordinates, ASN: loc.Location.AutonomousSystemNumber, ASOrg: loc.Location.AutonomousSystemOrganization, diff --git a/intel/entity.go b/intel/entity.go index c1685377..2e5283f6 100644 --- a/intel/entity.go +++ b/intel/entity.go @@ -251,7 +251,7 @@ func (e *Entity) getLocation(ctx context.Context) { return } e.location = loc - e.Country = loc.Country.ISOCode + e.Country = loc.Country.Code e.Coordinates = &loc.Coordinates e.ASN = loc.AutonomousSystemNumber e.ASOrg = loc.AutonomousSystemOrganization @@ -272,9 +272,10 @@ func (e *Entity) getLocation(ctx context.Context) { // Log location log.Tracer(ctx).Tracef( - "intel: located %s in %s (AS%d by %s)%s", + "intel: located %s in %s (%s), as part of AS%d by %s%s", e.IP, - loc.Country.ISOCode, + loc.Country.Name, + loc.Country.Code, loc.AutonomousSystemNumber, loc.AutonomousSystemOrganization, flags, @@ -303,6 +304,16 @@ func (e *Entity) GetCountry(ctx context.Context) (string, bool) { return e.Country, true } +// GetCountryInfo returns the two letter ISO country code and whether it is set. +func (e *Entity) GetCountryInfo(ctx context.Context) *geoip.CountryInfo { + e.getLocation(ctx) + + if e.LocationError != "" { + return nil + } + return &e.location.Country +} + // GetASN returns the AS number and whether it is set. func (e *Entity) GetASN(ctx context.Context) (uint, bool) { e.getLocation(ctx) diff --git a/intel/geoip/country_info.go b/intel/geoip/country_info.go index 28a2706a..06a87c4e 100644 --- a/intel/geoip/country_info.go +++ b/intel/geoip/country_info.go @@ -1,1776 +1,1321 @@ package geoip +import "strings" + const defaultCountryBasedAccuracy = 200 // AddCountryInfo adds missing country information to the location. func (l *Location) AddCountryInfo() { // Check if we have the country code. - if l.Country.ISOCode == "" { + if l.Country.Code == "" { return } // Get country info. - info, ok := countries[l.Country.ISOCode] + info, ok := countries[l.Country.Code] if !ok { return } + // Apply country info to location. + l.Country = info - // Add missing data. - if l.Country.Name == "" { - l.Country.Name = info.Name - } + // Use country center as location coordinates if unset. if l.Coordinates.Latitude == 0 && l.Coordinates.Longitude == 0 { l.Coordinates = info.Center - l.Coordinates.AccuracyRadius = defaultCountryBasedAccuracy } - // TODO: We are currently re-using the Continent-Code for the region. Update this and all dependencies. - l.Continent.Code = info.Region } // GetCountryInfo returns the country info of the given country code, or nil // in case the data does not exist. -func GetCountryInfo(countryCode string) *CountryInfo { +func GetCountryInfo(countryCode string) CountryInfo { info := countries[countryCode] - return &info + return info } // CountryInfo holds additional information about countries. type CountryInfo struct { - ID string - Name string - Region string - ContinentCode string - Center Coordinates + Code string `maxminddb:"iso_code"` + Name string + Center Coordinates + Continent ContinentInfo +} + +// ContinentInfo holds additional information about continents. +type ContinentInfo struct { + Code string + Region string + Name string +} + +// Add data to countries. +func init() { + for code, country := range countries { + // Set country code. + country.Code = code + + // Derive continent code from continental region. + country.Continent.Code, _, _ = strings.Cut(country.Continent.Region, "-") + + // Add continent name. + switch country.Continent.Code { + case "AF": + country.Continent.Name = "Africa" + case "AN": + country.Continent.Name = "Antarctica" + case "AS": + country.Continent.Name = "Asia" + case "EU": + country.Continent.Name = "Europe" + case "NA": + country.Continent.Name = "North America" + case "OC": + country.Continent.Name = "Oceania" + case "SA": + country.Continent.Name = "South America" + } + + // Add default accuracy radius. + country.Center.AccuracyRadius = defaultCountryBasedAccuracy + + // Apply back to map. + countries[code] = country + } } var countries = map[string]CountryInfo{ "MN": { - ID: "MN", - Name: "Mongolia", - Region: "AS-E", - ContinentCode: "AS", - Center: Coordinates{Latitude: 46.000000, Longitude: 103.000000}, + Name: "Mongolia", + Continent: ContinentInfo{Region: "AS-E"}, + Center: Coordinates{Latitude: 46.000000, Longitude: 103.000000}, }, "BN": { - ID: "BN", - Name: "Brunei Darussalam", - Region: "AS-SE", - ContinentCode: "AS", - Center: Coordinates{Latitude: 4.000000, Longitude: 114.000000}, + Name: "Brunei Darussalam", + Continent: ContinentInfo{Region: "AS-SE"}, + Center: Coordinates{Latitude: 4.000000, Longitude: 114.000000}, }, "GI": { - ID: "GI", - Name: "Gibraltar", - Region: "EU-S", - ContinentCode: "EU", - Center: Coordinates{Latitude: 36.000000, Longitude: -5.000000}, + Name: "Gibraltar", + Continent: ContinentInfo{Region: "EU-S"}, + Center: Coordinates{Latitude: 36.000000, Longitude: -5.000000}, }, "SO": { - ID: "SO", - Name: "Somalia", - Region: "AF-E", - ContinentCode: "AF", - Center: Coordinates{Latitude: 5.000000, Longitude: 46.000000}, + Name: "Somalia", + Continent: ContinentInfo{Region: "AF-E"}, + Center: Coordinates{Latitude: 5.000000, Longitude: 46.000000}, }, "GG": { - ID: "GG", - Name: "Guernsey", - Region: "EU-N", - ContinentCode: "EU", - Center: Coordinates{Latitude: 49.000000, Longitude: -2.000000}, + Name: "Guernsey", + Continent: ContinentInfo{Region: "EU-N"}, + Center: Coordinates{Latitude: 49.000000, Longitude: -2.000000}, }, "CL": { - ID: "CL", - Name: "Chile", - Region: "SA", - ContinentCode: "SA", - Center: Coordinates{Latitude: -35.000000, Longitude: -71.000000}, + Name: "Chile", + Continent: ContinentInfo{Region: "SA"}, + Center: Coordinates{Latitude: -35.000000, Longitude: -71.000000}, }, "LR": { - ID: "LR", - Name: "Liberia", - Region: "AF-W", - ContinentCode: "AF", - Center: Coordinates{Latitude: 6.000000, Longitude: -9.000000}, + Name: "Liberia", + Continent: ContinentInfo{Region: "AF-W"}, + Center: Coordinates{Latitude: 6.000000, Longitude: -9.000000}, }, "TZ": { - ID: "TZ", - Name: "Tanzania", - Region: "AF-E", - ContinentCode: "AF", - Center: Coordinates{Latitude: -6.000000, Longitude: 34.000000}, + Name: "Tanzania", + Continent: ContinentInfo{Region: "AF-E"}, + Center: Coordinates{Latitude: -6.000000, Longitude: 34.000000}, }, "MU": { - ID: "MU", - Name: "Mauritius", - Region: "AF-E", - ContinentCode: "AF", - Center: Coordinates{Latitude: -20.000000, Longitude: 57.000000}, + Name: "Mauritius", + Continent: ContinentInfo{Region: "AF-E"}, + Center: Coordinates{Latitude: -20.000000, Longitude: 57.000000}, }, "HM": { - ID: "HM", - Name: "Heard Island and McDonald Islands", - Region: "OC-S", - ContinentCode: "OC", - Center: Coordinates{Latitude: -53.000000, Longitude: 73.000000}, + Name: "Heard Island and McDonald Islands", + Continent: ContinentInfo{Region: "OC-S"}, + Center: Coordinates{Latitude: -53.000000, Longitude: 73.000000}, }, "AR": { - ID: "AR", - Name: "Argentina", - Region: "SA", - ContinentCode: "SA", - Center: Coordinates{Latitude: -38.000000, Longitude: -63.000000}, + Name: "Argentina", + Continent: ContinentInfo{Region: "SA"}, + Center: Coordinates{Latitude: -38.000000, Longitude: -63.000000}, }, "BV": { - ID: "BV", - Name: "Bouvet Island", - Region: "SA", - ContinentCode: "SA", - Center: Coordinates{Latitude: -54.000000, Longitude: 3.000000}, + Name: "Bouvet Island", + Continent: ContinentInfo{Region: "SA"}, + Center: Coordinates{Latitude: -54.000000, Longitude: 3.000000}, }, "MS": { - ID: "MS", - Name: "Montserrat", - Region: "NA-E", - ContinentCode: "NA", - Center: Coordinates{Latitude: 16.000000, Longitude: -62.000000}, + Name: "Montserrat", + Continent: ContinentInfo{Region: "NA-E"}, + Center: Coordinates{Latitude: 16.000000, Longitude: -62.000000}, }, "PT": { - ID: "PT", - Name: "Portugal", - Region: "EU-S", - ContinentCode: "EU", - Center: Coordinates{Latitude: 39.000000, Longitude: -8.000000}, + Name: "Portugal", + Continent: ContinentInfo{Region: "EU-S"}, + Center: Coordinates{Latitude: 39.000000, Longitude: -8.000000}, }, "BO": { - ID: "BO", - Name: "Bolivia", - Region: "SA", - ContinentCode: "SA", - Center: Coordinates{Latitude: -16.000000, Longitude: -63.000000}, + Name: "Bolivia", + Continent: ContinentInfo{Region: "SA"}, + Center: Coordinates{Latitude: -16.000000, Longitude: -63.000000}, }, "VC": { - ID: "VC", - Name: "Saint Vincent and the Grenadines", - Region: "NA-E", - ContinentCode: "NA", - Center: Coordinates{Latitude: 12.000000, Longitude: -61.000000}, + Name: "Saint Vincent and the Grenadines", + Continent: ContinentInfo{Region: "NA-E"}, + Center: Coordinates{Latitude: 12.000000, Longitude: -61.000000}, }, "RO": { - ID: "RO", - Name: "Romania", - Region: "EU-E", - ContinentCode: "EU", - Center: Coordinates{Latitude: 45.000000, Longitude: 24.000000}, + Name: "Romania", + Continent: ContinentInfo{Region: "EU-E"}, + Center: Coordinates{Latitude: 45.000000, Longitude: 24.000000}, }, "MK": { - ID: "MK", - Name: "North Macedonia", - Region: "EU-S", - ContinentCode: "EU", - Center: Coordinates{Latitude: 41.000000, Longitude: 21.000000}, + Name: "North Macedonia", + Continent: ContinentInfo{Region: "EU-S"}, + Center: Coordinates{Latitude: 41.000000, Longitude: 21.000000}, }, "UG": { - ID: "UG", - Name: "Uganda", - Region: "AF-E", - ContinentCode: "AF", - Center: Coordinates{Latitude: 1.000000, Longitude: 32.000000}, + Name: "Uganda", + Continent: ContinentInfo{Region: "AF-E"}, + Center: Coordinates{Latitude: 1.000000, Longitude: 32.000000}, }, "HN": { - ID: "HN", - Name: "Honduras", - Region: "NA-S", - ContinentCode: "NA", - Center: Coordinates{Latitude: 15.000000, Longitude: -86.000000}, + Name: "Honduras", + Continent: ContinentInfo{Region: "NA-S"}, + Center: Coordinates{Latitude: 15.000000, Longitude: -86.000000}, }, "IS": { - ID: "IS", - Name: "Iceland", - Region: "EU-N", - ContinentCode: "EU", - Center: Coordinates{Latitude: 64.000000, Longitude: -19.000000}, + Name: "Iceland", + Continent: ContinentInfo{Region: "EU-N"}, + Center: Coordinates{Latitude: 64.000000, Longitude: -19.000000}, }, "HR": { - ID: "HR", - Name: "Croatia", - Region: "EU-S", - ContinentCode: "EU", - Center: Coordinates{Latitude: 45.000000, Longitude: 15.000000}, + Name: "Croatia", + Continent: ContinentInfo{Region: "EU-S"}, + Center: Coordinates{Latitude: 45.000000, Longitude: 15.000000}, }, "PL": { - ID: "PL", - Name: "Poland", - Region: "EU-E", - ContinentCode: "EU", - Center: Coordinates{Latitude: 51.000000, Longitude: 19.000000}, + Name: "Poland", + Continent: ContinentInfo{Region: "EU-E"}, + Center: Coordinates{Latitude: 51.000000, Longitude: 19.000000}, }, "TC": { - ID: "TC", - Name: "Turks and Caicos Islands", - Region: "NA-E", - ContinentCode: "NA", - Center: Coordinates{Latitude: 21.000000, Longitude: -71.000000}, + Name: "Turks and Caicos Islands", + Continent: ContinentInfo{Region: "NA-E"}, + Center: Coordinates{Latitude: 21.000000, Longitude: -71.000000}, }, "LC": { - ID: "LC", - Name: "Saint Lucia", - Region: "NA-E", - ContinentCode: "NA", - Center: Coordinates{Latitude: 13.000000, Longitude: -60.000000}, + Name: "Saint Lucia", + Continent: ContinentInfo{Region: "NA-E"}, + Center: Coordinates{Latitude: 13.000000, Longitude: -60.000000}, }, "JP": { - ID: "JP", - Name: "Japan", - Region: "AS-E", - ContinentCode: "AS", - Center: Coordinates{Latitude: 36.000000, Longitude: 138.000000}, + Name: "Japan", + Continent: ContinentInfo{Region: "AS-E"}, + Center: Coordinates{Latitude: 36.000000, Longitude: 138.000000}, }, "TN": { - ID: "TN", - Name: "Tunisia", - Region: "AF-N", - ContinentCode: "AF", - Center: Coordinates{Latitude: 33.000000, Longitude: 9.000000}, + Name: "Tunisia", + Continent: ContinentInfo{Region: "AF-N"}, + Center: Coordinates{Latitude: 33.000000, Longitude: 9.000000}, }, "GS": { - ID: "GS", - Name: "South Georgia and the South Sandwich Islands", - Region: "SA", - ContinentCode: "SA", - Center: Coordinates{Latitude: -54.000000, Longitude: -36.000000}, + Name: "South Georgia and the South Sandwich Islands", + Continent: ContinentInfo{Region: "SA"}, + Center: Coordinates{Latitude: -54.000000, Longitude: -36.000000}, }, "MY": { - ID: "MY", - Name: "Malaysia", - Region: "AS-SE", - ContinentCode: "AS", - Center: Coordinates{Latitude: 4.000000, Longitude: 101.000000}, + Name: "Malaysia", + Continent: ContinentInfo{Region: "AS-SE"}, + Center: Coordinates{Latitude: 4.000000, Longitude: 101.000000}, }, "TT": { - ID: "TT", - Name: "Trinidad and Tobago", - Region: "NA-E", - ContinentCode: "NA", - Center: Coordinates{Latitude: 10.000000, Longitude: -61.000000}, + Name: "Trinidad and Tobago", + Continent: ContinentInfo{Region: "NA-E"}, + Center: Coordinates{Latitude: 10.000000, Longitude: -61.000000}, }, "BE": { - ID: "BE", - Name: "Belgium", - Region: "EU-W", - ContinentCode: "EU", - Center: Coordinates{Latitude: 50.000000, Longitude: 4.000000}, + Name: "Belgium", + Continent: ContinentInfo{Region: "EU-W"}, + Center: Coordinates{Latitude: 50.000000, Longitude: 4.000000}, }, "GU": { - ID: "GU", - Name: "Guam", - Region: "OC-N", - ContinentCode: "OC", - Center: Coordinates{Latitude: 13.000000, Longitude: 144.000000}, + Name: "Guam", + Continent: ContinentInfo{Region: "OC-N"}, + Center: Coordinates{Latitude: 13.000000, Longitude: 144.000000}, }, "NL": { - ID: "NL", - Name: "Netherlands", - Region: "EU-W", - ContinentCode: "EU", - Center: Coordinates{Latitude: 52.000000, Longitude: 5.000000}, + Name: "Netherlands", + Continent: ContinentInfo{Region: "EU-W"}, + Center: Coordinates{Latitude: 52.000000, Longitude: 5.000000}, }, "AF": { - ID: "AF", - Name: "Afghanistan", - Region: "AS-S", - ContinentCode: "AS", - Center: Coordinates{Latitude: 33.000000, Longitude: 67.000000}, + Name: "Afghanistan", + Continent: ContinentInfo{Region: "AS-S"}, + Center: Coordinates{Latitude: 33.000000, Longitude: 67.000000}, }, "CK": { - ID: "CK", - Name: "Cook Islands", - Region: "OC-E", - ContinentCode: "OC", - Center: Coordinates{Latitude: -21.000000, Longitude: -159.000000}, + Name: "Cook Islands", + Continent: ContinentInfo{Region: "OC-E"}, + Center: Coordinates{Latitude: -21.000000, Longitude: -159.000000}, }, "PM": { - ID: "PM", - Name: "Saint Pierre and Miquelon", - Region: "NA-N", - ContinentCode: "NA", - Center: Coordinates{Latitude: 46.000000, Longitude: -56.000000}, + Name: "Saint Pierre and Miquelon", + Continent: ContinentInfo{Region: "NA-N"}, + Center: Coordinates{Latitude: 46.000000, Longitude: -56.000000}, }, "OM": { - ID: "OM", - Name: "Oman", - Region: "AS-W", - ContinentCode: "AS", - Center: Coordinates{Latitude: 21.000000, Longitude: 55.000000}, + Name: "Oman", + Continent: ContinentInfo{Region: "AS-W"}, + Center: Coordinates{Latitude: 21.000000, Longitude: 55.000000}, }, "NP": { - ID: "NP", - Name: "Nepal", - Region: "AS-S", - ContinentCode: "AS", - Center: Coordinates{Latitude: 28.000000, Longitude: 84.000000}, + Name: "Nepal", + Continent: ContinentInfo{Region: "AS-S"}, + Center: Coordinates{Latitude: 28.000000, Longitude: 84.000000}, }, "RS": { - ID: "RS", - Name: "Serbia", - Region: "EU-S", - ContinentCode: "EU", - Center: Coordinates{Latitude: 44.000000, Longitude: 21.000000}, + Name: "Serbia", + Continent: ContinentInfo{Region: "EU-S"}, + Center: Coordinates{Latitude: 44.000000, Longitude: 21.000000}, }, "MW": { - ID: "MW", - Name: "Malawi", - Region: "AF-E", - ContinentCode: "AF", - Center: Coordinates{Latitude: -13.000000, Longitude: 34.000000}, + Name: "Malawi", + Continent: ContinentInfo{Region: "AF-E"}, + Center: Coordinates{Latitude: -13.000000, Longitude: 34.000000}, }, "NE": { - ID: "NE", - Name: "Niger", - Region: "AF-W", - ContinentCode: "AF", - Center: Coordinates{Latitude: 17.000000, Longitude: 8.000000}, + Name: "Niger", + Continent: ContinentInfo{Region: "AF-W"}, + Center: Coordinates{Latitude: 17.000000, Longitude: 8.000000}, }, "BY": { - ID: "BY", - Name: "Belarus", - Region: "EU-E", - ContinentCode: "EU", - Center: Coordinates{Latitude: 53.000000, Longitude: 27.000000}, + Name: "Belarus", + Continent: ContinentInfo{Region: "EU-E"}, + Center: Coordinates{Latitude: 53.000000, Longitude: 27.000000}, }, "TH": { - ID: "TH", - Name: "Thailand", - Region: "AS-SE", - ContinentCode: "AS", - Center: Coordinates{Latitude: 15.000000, Longitude: 100.000000}, + Name: "Thailand", + Continent: ContinentInfo{Region: "AS-SE"}, + Center: Coordinates{Latitude: 15.000000, Longitude: 100.000000}, }, "CW": { - ID: "CW", - Name: "Curaçao", - Region: "NA-E", - ContinentCode: "NA", - Center: Coordinates{Latitude: 12.000000, Longitude: -68.000000}, + Name: "Curaçao", + Continent: ContinentInfo{Region: "NA-E"}, + Center: Coordinates{Latitude: 12.000000, Longitude: -68.000000}, }, "AS": { - ID: "AS", - Name: "American Samoa", - Region: "OC-E", - ContinentCode: "OC", - Center: Coordinates{Latitude: -14.000000, Longitude: -170.000000}, + Name: "American Samoa", + Continent: ContinentInfo{Region: "OC-E"}, + Center: Coordinates{Latitude: -14.000000, Longitude: -170.000000}, }, "BF": { - ID: "BF", - Name: "Burkina Faso", - Region: "AF-W", - ContinentCode: "AF", - Center: Coordinates{Latitude: 12.000000, Longitude: -1.000000}, + Name: "Burkina Faso", + Continent: ContinentInfo{Region: "AF-W"}, + Center: Coordinates{Latitude: 12.000000, Longitude: -1.000000}, }, "BR": { - ID: "BR", - Name: "Brazil", - Region: "SA", - ContinentCode: "SA", - Center: Coordinates{Latitude: -14.000000, Longitude: -51.000000}, + Name: "Brazil", + Continent: ContinentInfo{Region: "SA"}, + Center: Coordinates{Latitude: -14.000000, Longitude: -51.000000}, }, "CX": { - ID: "CX", - Name: "Christmas Island", - Region: "OC-S", - ContinentCode: "OC", - Center: Coordinates{Latitude: -10.000000, Longitude: 105.000000}, + Name: "Christmas Island", + Continent: ContinentInfo{Region: "OC-S"}, + Center: Coordinates{Latitude: -10.000000, Longitude: 105.000000}, }, "MG": { - ID: "MG", - Name: "Madagascar", - Region: "AF-E", - ContinentCode: "AF", - Center: Coordinates{Latitude: -18.000000, Longitude: 46.000000}, + Name: "Madagascar", + Continent: ContinentInfo{Region: "AF-E"}, + Center: Coordinates{Latitude: -18.000000, Longitude: 46.000000}, }, "CY": { - ID: "CY", - Name: "Cyprus", - Region: "AS-W", - ContinentCode: "AS", - Center: Coordinates{Latitude: 35.000000, Longitude: 33.000000}, + Name: "Cyprus", + Continent: ContinentInfo{Region: "AS-W"}, + Center: Coordinates{Latitude: 35.000000, Longitude: 33.000000}, }, "KW": { - ID: "KW", - Name: "Kuwait", - Region: "AS-W", - ContinentCode: "AS", - Center: Coordinates{Latitude: 29.000000, Longitude: 47.000000}, + Name: "Kuwait", + Continent: ContinentInfo{Region: "AS-W"}, + Center: Coordinates{Latitude: 29.000000, Longitude: 47.000000}, }, "IT": { - ID: "IT", - Name: "Italy", - Region: "EU-S", - ContinentCode: "EU", - Center: Coordinates{Latitude: 41.000000, Longitude: 12.000000}, + Name: "Italy", + Continent: ContinentInfo{Region: "EU-S"}, + Center: Coordinates{Latitude: 41.000000, Longitude: 12.000000}, }, "SJ": { - ID: "SJ", - Name: "Svalbard and Jan Mayen", - Region: "EU-N", - ContinentCode: "EU", - Center: Coordinates{Latitude: 77.000000, Longitude: 23.000000}, + Name: "Svalbard and Jan Mayen", + Continent: ContinentInfo{Region: "EU-N"}, + Center: Coordinates{Latitude: 77.000000, Longitude: 23.000000}, }, "ZM": { - ID: "ZM", - Name: "Zambia", - Region: "AF-E", - ContinentCode: "AF", - Center: Coordinates{Latitude: -13.000000, Longitude: 27.000000}, + Name: "Zambia", + Continent: ContinentInfo{Region: "AF-E"}, + Center: Coordinates{Latitude: -13.000000, Longitude: 27.000000}, }, "TO": { - ID: "TO", - Name: "Tonga", - Region: "OC-E", - ContinentCode: "OC", - Center: Coordinates{Latitude: -21.000000, Longitude: -175.000000}, + Name: "Tonga", + Continent: ContinentInfo{Region: "OC-E"}, + Center: Coordinates{Latitude: -21.000000, Longitude: -175.000000}, }, "EE": { - ID: "EE", - Name: "Estonia", - Region: "EU-N", - ContinentCode: "EU", - Center: Coordinates{Latitude: 58.000000, Longitude: 25.000000}, + Name: "Estonia", + Continent: ContinentInfo{Region: "EU-N"}, + Center: Coordinates{Latitude: 58.000000, Longitude: 25.000000}, }, "LI": { - ID: "LI", - Name: "Liechtenstein", - Region: "EU-W", - ContinentCode: "EU", - Center: Coordinates{Latitude: 47.000000, Longitude: 9.000000}, + Name: "Liechtenstein", + Continent: ContinentInfo{Region: "EU-W"}, + Center: Coordinates{Latitude: 47.000000, Longitude: 9.000000}, }, "LB": { - ID: "LB", - Name: "Lebanon", - Region: "AS-W", - ContinentCode: "AS", - Center: Coordinates{Latitude: 33.000000, Longitude: 35.000000}, + Name: "Lebanon", + Continent: ContinentInfo{Region: "AS-W"}, + Center: Coordinates{Latitude: 33.000000, Longitude: 35.000000}, }, "DK": { - ID: "DK", - Name: "Denmark", - Region: "EU-N", - ContinentCode: "EU", - Center: Coordinates{Latitude: 56.000000, Longitude: 9.000000}, + Name: "Denmark", + Continent: ContinentInfo{Region: "EU-N"}, + Center: Coordinates{Latitude: 56.000000, Longitude: 9.000000}, }, "LS": { - ID: "LS", - Name: "Lesotho", - Region: "AF-S", - ContinentCode: "AF", - Center: Coordinates{Latitude: -29.000000, Longitude: 28.000000}, + Name: "Lesotho", + Continent: ContinentInfo{Region: "AF-S"}, + Center: Coordinates{Latitude: -29.000000, Longitude: 28.000000}, }, "CM": { - ID: "CM", - Name: "Cameroon", - Region: "AF-C", - ContinentCode: "AF", - Center: Coordinates{Latitude: 7.000000, Longitude: 12.000000}, + Name: "Cameroon", + Continent: ContinentInfo{Region: "AF-C"}, + Center: Coordinates{Latitude: 7.000000, Longitude: 12.000000}, }, "BH": { - ID: "BH", - Name: "Bahrain", - Region: "AS-W", - ContinentCode: "AS", - Center: Coordinates{Latitude: 25.000000, Longitude: 50.000000}, + Name: "Bahrain", + Continent: ContinentInfo{Region: "AS-W"}, + Center: Coordinates{Latitude: 25.000000, Longitude: 50.000000}, }, "NA": { - ID: "NA", - Name: "Namibia", - Region: "AF-S", - ContinentCode: "AF", - Center: Coordinates{Latitude: -22.000000, Longitude: 18.000000}, + Name: "Namibia", + Continent: ContinentInfo{Region: "AF-S"}, + Center: Coordinates{Latitude: -22.000000, Longitude: 18.000000}, }, "ZA": { - ID: "ZA", - Name: "South Africa", - Region: "AF-S", - ContinentCode: "AF", - Center: Coordinates{Latitude: -30.000000, Longitude: 22.000000}, + Name: "South Africa", + Continent: ContinentInfo{Region: "AF-S"}, + Center: Coordinates{Latitude: -30.000000, Longitude: 22.000000}, }, "PH": { - ID: "PH", - Name: "Philippines", - Region: "AS-SE", - ContinentCode: "AS", - Center: Coordinates{Latitude: 12.000000, Longitude: 121.000000}, + Name: "Philippines", + Continent: ContinentInfo{Region: "AS-SE"}, + Center: Coordinates{Latitude: 12.000000, Longitude: 121.000000}, }, "JM": { - ID: "JM", - Name: "Jamaica", - Region: "NA-E", - ContinentCode: "NA", - Center: Coordinates{Latitude: 18.000000, Longitude: -77.000000}, + Name: "Jamaica", + Continent: ContinentInfo{Region: "NA-E"}, + Center: Coordinates{Latitude: 18.000000, Longitude: -77.000000}, }, "PS": { - ID: "PS", - Name: "Palestine", - Region: "AS-W", - ContinentCode: "AS", - Center: Coordinates{Latitude: 31.000000, Longitude: 35.000000}, + Name: "Palestine", + Continent: ContinentInfo{Region: "AS-W"}, + Center: Coordinates{Latitude: 31.000000, Longitude: 35.000000}, }, "TM": { - ID: "TM", - Name: "Turkmenistan", - Region: "AS-C", - ContinentCode: "AS", - Center: Coordinates{Latitude: 38.000000, Longitude: 59.000000}, + Name: "Turkmenistan", + Continent: ContinentInfo{Region: "AS-C"}, + Center: Coordinates{Latitude: 38.000000, Longitude: 59.000000}, }, "SD": { - ID: "SD", - Name: "Sudan", - Region: "AF-N", - ContinentCode: "AF", - Center: Coordinates{Latitude: 12.000000, Longitude: 30.000000}, + Name: "Sudan", + Continent: ContinentInfo{Region: "AF-N"}, + Center: Coordinates{Latitude: 12.000000, Longitude: 30.000000}, }, "KN": { - ID: "KN", - Name: "Saint Kitts and Nevis", - Region: "NA-E", - ContinentCode: "NA", - Center: Coordinates{Latitude: 17.000000, Longitude: -62.000000}, + Name: "Saint Kitts and Nevis", + Continent: ContinentInfo{Region: "NA-E"}, + Center: Coordinates{Latitude: 17.000000, Longitude: -62.000000}, }, "GF": { - ID: "GF", - Name: "French Guiana", - Region: "SA", - ContinentCode: "SA", - Center: Coordinates{Latitude: 3.000000, Longitude: -53.000000}, + Name: "French Guiana", + Continent: ContinentInfo{Region: "SA"}, + Center: Coordinates{Latitude: 3.000000, Longitude: -53.000000}, }, "WS": { - ID: "WS", - Name: "Samoa", - Region: "OC-E", - ContinentCode: "OC", - Center: Coordinates{Latitude: -13.000000, Longitude: -172.000000}, + Name: "Samoa", + Continent: ContinentInfo{Region: "OC-E"}, + Center: Coordinates{Latitude: -13.000000, Longitude: -172.000000}, }, "KE": { - ID: "KE", - Name: "Kenya", - Region: "AF-E", - ContinentCode: "AF", - Center: Coordinates{Latitude: 0.000000, Longitude: 37.000000}, + Name: "Kenya", + Continent: ContinentInfo{Region: "AF-E"}, + Center: Coordinates{Latitude: 0.000000, Longitude: 37.000000}, }, "CG": { - ID: "CG", - Name: "Congo", - Region: "AF-C", - ContinentCode: "AF", - Center: Coordinates{Latitude: 0.000000, Longitude: 15.000000}, + Name: "Congo", + Continent: ContinentInfo{Region: "AF-C"}, + Center: Coordinates{Latitude: 0.000000, Longitude: 15.000000}, }, "FJ": { - ID: "FJ", - Name: "Fiji", - Region: "OC-C", - ContinentCode: "OC", - Center: Coordinates{Latitude: -16.000000, Longitude: 179.000000}, + Name: "Fiji", + Continent: ContinentInfo{Region: "OC-C"}, + Center: Coordinates{Latitude: -16.000000, Longitude: 179.000000}, }, "BL": { - ID: "BL", - Name: "Saint Barthélemy", - Region: "NA-E", - ContinentCode: "NA", - Center: Coordinates{Latitude: 17.000000, Longitude: -62.000000}, + Name: "Saint Barthélemy", + Continent: ContinentInfo{Region: "NA-E"}, + Center: Coordinates{Latitude: 17.000000, Longitude: -62.000000}, }, "TD": { - ID: "TD", - Name: "Chad", - Region: "AF-C", - ContinentCode: "AF", - Center: Coordinates{Latitude: 15.000000, Longitude: 18.000000}, + Name: "Chad", + Continent: ContinentInfo{Region: "AF-C"}, + Center: Coordinates{Latitude: 15.000000, Longitude: 18.000000}, }, "TW": { - ID: "TW", - Name: "Taiwan", - Region: "AS-E", - ContinentCode: "AS", - Center: Coordinates{Latitude: 23.000000, Longitude: 120.000000}, + Name: "Taiwan", + Continent: ContinentInfo{Region: "AS-E"}, + Center: Coordinates{Latitude: 23.000000, Longitude: 120.000000}, }, "SA": { - ID: "SA", - Name: "Saudi Arabia", - Region: "AS-W", - ContinentCode: "AS", - Center: Coordinates{Latitude: 23.000000, Longitude: 45.000000}, + Name: "Saudi Arabia", + Continent: ContinentInfo{Region: "AS-W"}, + Center: Coordinates{Latitude: 23.000000, Longitude: 45.000000}, }, "CO": { - ID: "CO", - Name: "Colombia", - Region: "SA", - ContinentCode: "SA", - Center: Coordinates{Latitude: 4.000000, Longitude: -74.000000}, + Name: "Colombia", + Continent: ContinentInfo{Region: "SA"}, + Center: Coordinates{Latitude: 4.000000, Longitude: -74.000000}, }, "FR": { - ID: "FR", - Name: "France", - Region: "EU-W", - ContinentCode: "EU", - Center: Coordinates{Latitude: 46.000000, Longitude: 2.000000}, + Name: "France", + Continent: ContinentInfo{Region: "EU-W"}, + Center: Coordinates{Latitude: 46.000000, Longitude: 2.000000}, }, "WF": { - ID: "WF", - Name: "Wallis and Futuna", - Region: "OC-E", - ContinentCode: "OC", - Center: Coordinates{Latitude: -13.000000, Longitude: -177.000000}, + Name: "Wallis and Futuna", + Continent: ContinentInfo{Region: "OC-E"}, + Center: Coordinates{Latitude: -13.000000, Longitude: -177.000000}, }, "QA": { - ID: "QA", - Name: "Qatar", - Region: "AS-W", - ContinentCode: "AS", - Center: Coordinates{Latitude: 25.000000, Longitude: 51.000000}, + Name: "Qatar", + Continent: ContinentInfo{Region: "AS-W"}, + Center: Coordinates{Latitude: 25.000000, Longitude: 51.000000}, }, "IO": { - ID: "IO", - Name: "British Indian Ocean Territory", - Region: "AF-E", - ContinentCode: "AF", - Center: Coordinates{Latitude: -6.000000, Longitude: 71.000000}, + Name: "British Indian Ocean Territory", + Continent: ContinentInfo{Region: "AF-E"}, + Center: Coordinates{Latitude: -6.000000, Longitude: 71.000000}, }, "LT": { - ID: "LT", - Name: "Lithuania", - Region: "EU-N", - ContinentCode: "EU", - Center: Coordinates{Latitude: 55.000000, Longitude: 23.000000}, + Name: "Lithuania", + Continent: ContinentInfo{Region: "EU-N"}, + Center: Coordinates{Latitude: 55.000000, Longitude: 23.000000}, }, "IE": { - ID: "IE", - Name: "Ireland", - Region: "EU-N", - ContinentCode: "EU", - Center: Coordinates{Latitude: 53.000000, Longitude: -8.000000}, + Name: "Ireland", + Continent: ContinentInfo{Region: "EU-N"}, + Center: Coordinates{Latitude: 53.000000, Longitude: -8.000000}, }, "GW": { - ID: "GW", - Name: "Guinea-Bissau", - Region: "AF-W", - ContinentCode: "AF", - Center: Coordinates{Latitude: 11.000000, Longitude: -15.000000}, + Name: "Guinea-Bissau", + Continent: ContinentInfo{Region: "AF-W"}, + Center: Coordinates{Latitude: 11.000000, Longitude: -15.000000}, }, "PE": { - ID: "PE", - Name: "Peru", - Region: "SA", - ContinentCode: "SA", - Center: Coordinates{Latitude: -9.000000, Longitude: -75.000000}, + Name: "Peru", + Continent: ContinentInfo{Region: "SA"}, + Center: Coordinates{Latitude: -9.000000, Longitude: -75.000000}, }, "MA": { - ID: "MA", - Name: "Morocco", - Region: "AF-N", - ContinentCode: "AF", - Center: Coordinates{Latitude: 31.000000, Longitude: -7.000000}, + Name: "Morocco", + Continent: ContinentInfo{Region: "AF-N"}, + Center: Coordinates{Latitude: 31.000000, Longitude: -7.000000}, }, "CR": { - ID: "CR", - Name: "Costa Rica", - Region: "NA-S", - ContinentCode: "NA", - Center: Coordinates{Latitude: 9.000000, Longitude: -83.000000}, + Name: "Costa Rica", + Continent: ContinentInfo{Region: "NA-S"}, + Center: Coordinates{Latitude: 9.000000, Longitude: -83.000000}, }, "FK": { - ID: "FK", - Name: "Falkland Islands (Malvinas)", - Region: "SA", - ContinentCode: "SA", - Center: Coordinates{Latitude: -51.000000, Longitude: -59.000000}, + Name: "Falkland Islands (Malvinas)", + Continent: ContinentInfo{Region: "SA"}, + Center: Coordinates{Latitude: -51.000000, Longitude: -59.000000}, }, "PW": { - ID: "PW", - Name: "Palau", - Region: "OC-N", - ContinentCode: "OC", - Center: Coordinates{Latitude: 7.000000, Longitude: 134.000000}, + Name: "Palau", + Continent: ContinentInfo{Region: "OC-N"}, + Center: Coordinates{Latitude: 7.000000, Longitude: 134.000000}, }, "NC": { - ID: "NC", - Name: "New Caledonia", - Region: "OC-C", - ContinentCode: "OC", - Center: Coordinates{Latitude: -20.000000, Longitude: 165.000000}, + Name: "New Caledonia", + Continent: ContinentInfo{Region: "OC-C"}, + Center: Coordinates{Latitude: -20.000000, Longitude: 165.000000}, }, "AM": { - ID: "AM", - Name: "Armenia", - Region: "AS-W", - ContinentCode: "AS", - Center: Coordinates{Latitude: 40.000000, Longitude: 45.000000}, + Name: "Armenia", + Continent: ContinentInfo{Region: "AS-W"}, + Center: Coordinates{Latitude: 40.000000, Longitude: 45.000000}, }, "CU": { - ID: "CU", - Name: "Cuba", - Region: "NA-E", - ContinentCode: "NA", - Center: Coordinates{Latitude: 21.000000, Longitude: -77.000000}, + Name: "Cuba", + Continent: ContinentInfo{Region: "NA-E"}, + Center: Coordinates{Latitude: 21.000000, Longitude: -77.000000}, }, "DE": { - ID: "DE", - Name: "Germany", - Region: "EU-W", - ContinentCode: "EU", - Center: Coordinates{Latitude: 51.000000, Longitude: 10.000000}, + Name: "Germany", + Continent: ContinentInfo{Region: "EU-W"}, + Center: Coordinates{Latitude: 51.000000, Longitude: 10.000000}, }, "MT": { - ID: "MT", - Name: "Malta", - Region: "EU-S", - ContinentCode: "EU", - Center: Coordinates{Latitude: 35.000000, Longitude: 14.000000}, + Name: "Malta", + Continent: ContinentInfo{Region: "EU-S"}, + Center: Coordinates{Latitude: 35.000000, Longitude: 14.000000}, }, "YE": { - ID: "YE", - Name: "Yemen", - Region: "AS-W", - ContinentCode: "AS", - Center: Coordinates{Latitude: 15.000000, Longitude: 48.000000}, + Name: "Yemen", + Continent: ContinentInfo{Region: "AS-W"}, + Center: Coordinates{Latitude: 15.000000, Longitude: 48.000000}, }, "BA": { - ID: "BA", - Name: "Bosnia and Herzegovina", - Region: "EU-S", - ContinentCode: "EU", - Center: Coordinates{Latitude: 43.000000, Longitude: 17.000000}, + Name: "Bosnia and Herzegovina", + Continent: ContinentInfo{Region: "EU-S"}, + Center: Coordinates{Latitude: 43.000000, Longitude: 17.000000}, }, "MP": { - ID: "MP", - Name: "Northern Mariana Islands", - Region: "OC-N", - ContinentCode: "OC", - Center: Coordinates{Latitude: 17.000000, Longitude: 145.000000}, + Name: "Northern Mariana Islands", + Continent: ContinentInfo{Region: "OC-N"}, + Center: Coordinates{Latitude: 17.000000, Longitude: 145.000000}, }, "PY": { - ID: "PY", - Name: "Paraguay", - Region: "SA", - ContinentCode: "SA", - Center: Coordinates{Latitude: -23.000000, Longitude: -58.000000}, + Name: "Paraguay", + Continent: ContinentInfo{Region: "SA"}, + Center: Coordinates{Latitude: -23.000000, Longitude: -58.000000}, }, "MO": { - ID: "MO", - Name: "Macao", - Region: "AS-E", - ContinentCode: "AS", - Center: Coordinates{Latitude: 22.000000, Longitude: 113.000000}, + Name: "Macao", + Continent: ContinentInfo{Region: "AS-E"}, + Center: Coordinates{Latitude: 22.000000, Longitude: 113.000000}, }, "SH": { - ID: "SH", - Name: "Saint Helena", - Region: "AF-W", - ContinentCode: "AF", - Center: Coordinates{Latitude: -24.000000, Longitude: -10.000000}, + Name: "Saint Helena", + Continent: ContinentInfo{Region: "AF-W"}, + Center: Coordinates{Latitude: -24.000000, Longitude: -10.000000}, }, "PN": { - ID: "PN", - Name: "Pitcairn", - Region: "OC-E", - ContinentCode: "OC", - Center: Coordinates{Latitude: -24.000000, Longitude: -127.000000}, + Name: "Pitcairn", + Continent: ContinentInfo{Region: "OC-E"}, + Center: Coordinates{Latitude: -24.000000, Longitude: -127.000000}, }, "GM": { - ID: "GM", - Name: "Gambia", - Region: "AF-W", - ContinentCode: "AF", - Center: Coordinates{Latitude: 13.000000, Longitude: -15.000000}, + Name: "Gambia", + Continent: ContinentInfo{Region: "AF-W"}, + Center: Coordinates{Latitude: 13.000000, Longitude: -15.000000}, }, "TG": { - ID: "TG", - Name: "Togo", - Region: "AF-W", - ContinentCode: "AF", - Center: Coordinates{Latitude: 8.000000, Longitude: 0.000000}, + Name: "Togo", + Continent: ContinentInfo{Region: "AF-W"}, + Center: Coordinates{Latitude: 8.000000, Longitude: 0.000000}, }, "AT": { - ID: "AT", - Name: "Austria", - Region: "EU-W", - ContinentCode: "EU", - Center: Coordinates{Latitude: 47.000000, Longitude: 14.000000}, + Name: "Austria", + Continent: ContinentInfo{Region: "EU-W"}, + Center: Coordinates{Latitude: 47.000000, Longitude: 14.000000}, }, "GT": { - ID: "GT", - Name: "Guatemala", - Region: "NA-S", - ContinentCode: "NA", - Center: Coordinates{Latitude: 15.000000, Longitude: -90.000000}, + Name: "Guatemala", + Continent: ContinentInfo{Region: "NA-S"}, + Center: Coordinates{Latitude: 15.000000, Longitude: -90.000000}, }, "AE": { - ID: "AE", - Name: "United Arab Emirates", - Region: "AS-W", - ContinentCode: "AS", - Center: Coordinates{Latitude: 23.000000, Longitude: 53.000000}, + Name: "United Arab Emirates", + Continent: ContinentInfo{Region: "AS-W"}, + Center: Coordinates{Latitude: 23.000000, Longitude: 53.000000}, }, "KR": { - ID: "KR", - Name: "South Korea", - Region: "AS-E", - ContinentCode: "AS", - Center: Coordinates{Latitude: 35.000000, Longitude: 127.000000}, + Name: "South Korea", + Continent: ContinentInfo{Region: "AS-E"}, + Center: Coordinates{Latitude: 35.000000, Longitude: 127.000000}, }, "JE": { - ID: "JE", - Name: "Jersey", - Region: "EU-N", - ContinentCode: "EU", - Center: Coordinates{Latitude: 49.000000, Longitude: -2.000000}, + Name: "Jersey", + Continent: ContinentInfo{Region: "EU-N"}, + Center: Coordinates{Latitude: 49.000000, Longitude: -2.000000}, }, "LV": { - ID: "LV", - Name: "Latvia", - Region: "EU-N", - ContinentCode: "EU", - Center: Coordinates{Latitude: 56.000000, Longitude: 24.000000}, + Name: "Latvia", + Continent: ContinentInfo{Region: "EU-N"}, + Center: Coordinates{Latitude: 56.000000, Longitude: 24.000000}, }, "AW": { - ID: "AW", - Name: "Aruba", - Region: "NA-E", - ContinentCode: "NA", - Center: Coordinates{Latitude: 12.000000, Longitude: -69.000000}, + Name: "Aruba", + Continent: ContinentInfo{Region: "NA-E"}, + Center: Coordinates{Latitude: 12.000000, Longitude: -69.000000}, }, "AO": { - ID: "AO", - Name: "Angola", - Region: "AF-C", - ContinentCode: "AF", - Center: Coordinates{Latitude: -11.000000, Longitude: 17.000000}, + Name: "Angola", + Continent: ContinentInfo{Region: "AF-C"}, + Center: Coordinates{Latitude: -11.000000, Longitude: 17.000000}, }, "VE": { - ID: "VE", - Name: "Venezuela", - Region: "SA", - ContinentCode: "SA", - Center: Coordinates{Latitude: 6.000000, Longitude: -66.000000}, + Name: "Venezuela", + Continent: ContinentInfo{Region: "SA"}, + Center: Coordinates{Latitude: 6.000000, Longitude: -66.000000}, }, "AG": { - ID: "AG", - Name: "Antigua and Barbuda", - Region: "NA-E", - ContinentCode: "NA", - Center: Coordinates{Latitude: 17.000000, Longitude: -61.000000}, + Name: "Antigua and Barbuda", + Continent: ContinentInfo{Region: "NA-E"}, + Center: Coordinates{Latitude: 17.000000, Longitude: -61.000000}, }, "NU": { - ID: "NU", - Name: "Niue", - Region: "OC-E", - ContinentCode: "OC", - Center: Coordinates{Latitude: -19.000000, Longitude: -169.000000}, + Name: "Niue", + Continent: ContinentInfo{Region: "OC-E"}, + Center: Coordinates{Latitude: -19.000000, Longitude: -169.000000}, }, "KY": { - ID: "KY", - Name: "Cayman Islands", - Region: "NA-E", - ContinentCode: "NA", - Center: Coordinates{Latitude: 19.000000, Longitude: -80.000000}, + Name: "Cayman Islands", + Continent: ContinentInfo{Region: "NA-E"}, + Center: Coordinates{Latitude: 19.000000, Longitude: -80.000000}, }, "IM": { - ID: "IM", - Name: "Isle of Man", - Region: "EU-N", - ContinentCode: "EU", - Center: Coordinates{Latitude: 54.000000, Longitude: -4.000000}, + Name: "Isle of Man", + Continent: ContinentInfo{Region: "EU-N"}, + Center: Coordinates{Latitude: 54.000000, Longitude: -4.000000}, }, "FM": { - ID: "FM", - Name: "Micronesia", - Region: "OC-N", - ContinentCode: "OC", - Center: Coordinates{Latitude: 7.000000, Longitude: 150.000000}, + Name: "Micronesia", + Continent: ContinentInfo{Region: "OC-N"}, + Center: Coordinates{Latitude: 7.000000, Longitude: 150.000000}, }, "SB": { - ID: "SB", - Name: "Solomon Islands", - Region: "OC-C", - ContinentCode: "OC", - Center: Coordinates{Latitude: -9.000000, Longitude: 160.000000}, + Name: "Solomon Islands", + Continent: ContinentInfo{Region: "OC-C"}, + Center: Coordinates{Latitude: -9.000000, Longitude: 160.000000}, }, "LU": { - ID: "LU", - Name: "Luxembourg", - Region: "EU-W", - ContinentCode: "EU", - Center: Coordinates{Latitude: 49.000000, Longitude: 6.000000}, + Name: "Luxembourg", + Continent: ContinentInfo{Region: "EU-W"}, + Center: Coordinates{Latitude: 49.000000, Longitude: 6.000000}, }, "MF": { - ID: "MF", - Name: "Saint Martin", - Region: "NA-E", - ContinentCode: "NA", - Center: Coordinates{Latitude: 18.000000, Longitude: -63.000000}, + Name: "Saint Martin", + Continent: ContinentInfo{Region: "NA-E"}, + Center: Coordinates{Latitude: 18.000000, Longitude: -63.000000}, }, "AQ": { - ID: "AQ", - Name: "Antarctica", - Region: "AN", - ContinentCode: "AN", - Center: Coordinates{Latitude: -75.000000, Longitude: 0.000000}, + Name: "Antarctica", + Continent: ContinentInfo{Region: "AN"}, + Center: Coordinates{Latitude: -75.000000, Longitude: 0.000000}, }, "SC": { - ID: "SC", - Name: "Seychelles", - Region: "AF-E", - ContinentCode: "AF", - Center: Coordinates{Latitude: -4.000000, Longitude: 55.000000}, + Name: "Seychelles", + Continent: ContinentInfo{Region: "AF-E"}, + Center: Coordinates{Latitude: -4.000000, Longitude: 55.000000}, }, "TL": { - ID: "TL", - Name: "Timor-Leste", - Region: "AS-SE", - ContinentCode: "AS", - Center: Coordinates{Latitude: -8.000000, Longitude: 125.000000}, + Name: "Timor-Leste", + Continent: ContinentInfo{Region: "AS-SE"}, + Center: Coordinates{Latitude: -8.000000, Longitude: 125.000000}, }, "CC": { - ID: "CC", - Name: "Cocos (Keeling) Islands", - Region: "OC-S", - ContinentCode: "OC", - Center: Coordinates{Latitude: -12.000000, Longitude: 96.000000}, + Name: "Cocos (Keeling) Islands", + Continent: ContinentInfo{Region: "OC-S"}, + Center: Coordinates{Latitude: -12.000000, Longitude: 96.000000}, }, "ST": { - ID: "ST", - Name: "Sao Tome and Principe", - Region: "AF-C", - ContinentCode: "AF", - Center: Coordinates{Latitude: 0.000000, Longitude: 6.000000}, + Name: "Sao Tome and Principe", + Continent: ContinentInfo{Region: "AF-C"}, + Center: Coordinates{Latitude: 0.000000, Longitude: 6.000000}, }, "NO": { - ID: "NO", - Name: "Norway", - Region: "EU-N", - ContinentCode: "EU", - Center: Coordinates{Latitude: 60.000000, Longitude: 8.000000}, + Name: "Norway", + Continent: ContinentInfo{Region: "EU-N"}, + Center: Coordinates{Latitude: 60.000000, Longitude: 8.000000}, }, "CF": { - ID: "CF", - Name: "Central African Republic", - Region: "AF-C", - ContinentCode: "AF", - Center: Coordinates{Latitude: 6.000000, Longitude: 20.000000}, + Name: "Central African Republic", + Continent: ContinentInfo{Region: "AF-C"}, + Center: Coordinates{Latitude: 6.000000, Longitude: 20.000000}, }, "MR": { - ID: "MR", - Name: "Mauritania", - Region: "AF-W", - ContinentCode: "AF", - Center: Coordinates{Latitude: 21.000000, Longitude: -10.000000}, + Name: "Mauritania", + Continent: ContinentInfo{Region: "AF-W"}, + Center: Coordinates{Latitude: 21.000000, Longitude: -10.000000}, }, "NI": { - ID: "NI", - Name: "Nicaragua", - Region: "NA-S", - ContinentCode: "NA", - Center: Coordinates{Latitude: 12.000000, Longitude: -85.000000}, + Name: "Nicaragua", + Continent: ContinentInfo{Region: "NA-S"}, + Center: Coordinates{Latitude: 12.000000, Longitude: -85.000000}, }, "AI": { - ID: "AI", - Name: "Anguilla", - Region: "NA-E", - ContinentCode: "NA", - Center: Coordinates{Latitude: 18.000000, Longitude: -63.000000}, + Name: "Anguilla", + Continent: ContinentInfo{Region: "NA-E"}, + Center: Coordinates{Latitude: 18.000000, Longitude: -63.000000}, }, "AZ": { - ID: "AZ", - Name: "Azerbaijan", - Region: "AS-W", - ContinentCode: "AS", - Center: Coordinates{Latitude: 40.000000, Longitude: 47.000000}, + Name: "Azerbaijan", + Continent: ContinentInfo{Region: "AS-W"}, + Center: Coordinates{Latitude: 40.000000, Longitude: 47.000000}, }, "US": { - ID: "US", - Name: "United States of America", - Region: "NA-N", - ContinentCode: "NA", - Center: Coordinates{Latitude: 37.000000, Longitude: -95.000000}, + Name: "United States of America", + Continent: ContinentInfo{Region: "NA-N"}, + Center: Coordinates{Latitude: 37.000000, Longitude: -95.000000}, }, "LA": { - ID: "LA", - Name: "Lao", - Region: "AS-SE", - ContinentCode: "AS", - Center: Coordinates{Latitude: 19.000000, Longitude: 102.000000}, + Name: "Lao", + Continent: ContinentInfo{Region: "AS-SE"}, + Center: Coordinates{Latitude: 19.000000, Longitude: 102.000000}, }, "BB": { - ID: "BB", - Name: "Barbados", - Region: "NA-E", - ContinentCode: "NA", - Center: Coordinates{Latitude: 13.000000, Longitude: -59.000000}, + Name: "Barbados", + Continent: ContinentInfo{Region: "NA-E"}, + Center: Coordinates{Latitude: 13.000000, Longitude: -59.000000}, }, "CD": { - ID: "CD", - Name: "DR Congo", - Region: "AF-C", - ContinentCode: "AF", - Center: Coordinates{Latitude: -4.000000, Longitude: 21.000000}, + Name: "DR Congo", + Continent: ContinentInfo{Region: "AF-C"}, + Center: Coordinates{Latitude: -4.000000, Longitude: 21.000000}, }, "TK": { - ID: "TK", - Name: "Tokelau", - Region: "OC-E", - ContinentCode: "OC", - Center: Coordinates{Latitude: -8.000000, Longitude: -171.000000}, + Name: "Tokelau", + Continent: ContinentInfo{Region: "OC-E"}, + Center: Coordinates{Latitude: -8.000000, Longitude: -171.000000}, }, "KZ": { - ID: "KZ", - Name: "Kazakhstan", - Region: "AS-C", - ContinentCode: "AS", - Center: Coordinates{Latitude: 48.000000, Longitude: 66.000000}, + Name: "Kazakhstan", + Continent: ContinentInfo{Region: "AS-C"}, + Center: Coordinates{Latitude: 48.000000, Longitude: 66.000000}, }, "DM": { - ID: "DM", - Name: "Dominica", - Region: "NA-E", - ContinentCode: "NA", - Center: Coordinates{Latitude: 15.000000, Longitude: -61.000000}, + Name: "Dominica", + Continent: ContinentInfo{Region: "NA-E"}, + Center: Coordinates{Latitude: 15.000000, Longitude: -61.000000}, }, "EG": { - ID: "EG", - Name: "Egypt", - Region: "AF-N", - ContinentCode: "AF", - Center: Coordinates{Latitude: 26.000000, Longitude: 30.000000}, + Name: "Egypt", + Continent: ContinentInfo{Region: "AF-N"}, + Center: Coordinates{Latitude: 26.000000, Longitude: 30.000000}, }, "GH": { - ID: "GH", - Name: "Ghana", - Region: "AF-W", - ContinentCode: "AF", - Center: Coordinates{Latitude: 7.000000, Longitude: -1.000000}, + Name: "Ghana", + Continent: ContinentInfo{Region: "AF-W"}, + Center: Coordinates{Latitude: 7.000000, Longitude: -1.000000}, }, "BI": { - ID: "BI", - Name: "Burundi", - Region: "AF-E", - ContinentCode: "AF", - Center: Coordinates{Latitude: -3.000000, Longitude: 29.000000}, + Name: "Burundi", + Continent: ContinentInfo{Region: "AF-E"}, + Center: Coordinates{Latitude: -3.000000, Longitude: 29.000000}, }, "NZ": { - ID: "NZ", - Name: "New Zealand", - Region: "OC-S", - ContinentCode: "OC", - Center: Coordinates{Latitude: -40.000000, Longitude: 174.000000}, + Name: "New Zealand", + Continent: ContinentInfo{Region: "OC-S"}, + Center: Coordinates{Latitude: -40.000000, Longitude: 174.000000}, }, "BJ": { - ID: "BJ", - Name: "Benin", - Region: "AF-W", - ContinentCode: "AF", - Center: Coordinates{Latitude: 9.000000, Longitude: 2.000000}, + Name: "Benin", + Continent: ContinentInfo{Region: "AF-W"}, + Center: Coordinates{Latitude: 9.000000, Longitude: 2.000000}, }, "HU": { - ID: "HU", - Name: "Hungary", - Region: "EU-E", - ContinentCode: "EU", - Center: Coordinates{Latitude: 47.000000, Longitude: 19.000000}, + Name: "Hungary", + Continent: ContinentInfo{Region: "EU-E"}, + Center: Coordinates{Latitude: 47.000000, Longitude: 19.000000}, }, "BD": { - ID: "BD", - Name: "Bangladesh", - Region: "AS-S", - ContinentCode: "AS", - Center: Coordinates{Latitude: 23.000000, Longitude: 90.000000}, + Name: "Bangladesh", + Continent: ContinentInfo{Region: "AS-S"}, + Center: Coordinates{Latitude: 23.000000, Longitude: 90.000000}, }, "NF": { - ID: "NF", - Name: "Norfolk Island", - Region: "OC-S", - ContinentCode: "OC", - Center: Coordinates{Latitude: -29.000000, Longitude: 167.000000}, + Name: "Norfolk Island", + Continent: ContinentInfo{Region: "OC-S"}, + Center: Coordinates{Latitude: -29.000000, Longitude: 167.000000}, }, "LY": { - ID: "LY", - Name: "Libya", - Region: "AF-N", - ContinentCode: "AF", - Center: Coordinates{Latitude: 26.000000, Longitude: 17.000000}, + Name: "Libya", + Continent: ContinentInfo{Region: "AF-N"}, + Center: Coordinates{Latitude: 26.000000, Longitude: 17.000000}, }, "TV": { - ID: "TV", - Name: "Tuvalu", - Region: "OC-E", - ContinentCode: "OC", - Center: Coordinates{Latitude: -7.000000, Longitude: 177.000000}, + Name: "Tuvalu", + Continent: ContinentInfo{Region: "OC-E"}, + Center: Coordinates{Latitude: -7.000000, Longitude: 177.000000}, }, "ZW": { - ID: "ZW", - Name: "Zimbabwe", - Region: "AF-E", - ContinentCode: "AF", - Center: Coordinates{Latitude: -19.000000, Longitude: 29.000000}, + Name: "Zimbabwe", + Continent: ContinentInfo{Region: "AF-E"}, + Center: Coordinates{Latitude: -19.000000, Longitude: 29.000000}, }, "NG": { - ID: "NG", - Name: "Nigeria", - Region: "AF-W", - ContinentCode: "AF", - Center: Coordinates{Latitude: 9.000000, Longitude: 8.000000}, + Name: "Nigeria", + Continent: ContinentInfo{Region: "AF-W"}, + Center: Coordinates{Latitude: 9.000000, Longitude: 8.000000}, }, "GD": { - ID: "GD", - Name: "Grenada", - Region: "NA-E", - ContinentCode: "NA", - Center: Coordinates{Latitude: 12.000000, Longitude: -61.000000}, + Name: "Grenada", + Continent: ContinentInfo{Region: "NA-E"}, + Center: Coordinates{Latitude: 12.000000, Longitude: -61.000000}, }, "SM": { - ID: "SM", - Name: "San Marino", - Region: "EU-S", - ContinentCode: "EU", - Center: Coordinates{Latitude: 43.000000, Longitude: 12.000000}, + Name: "San Marino", + Continent: ContinentInfo{Region: "EU-S"}, + Center: Coordinates{Latitude: 43.000000, Longitude: 12.000000}, }, "RU": { - ID: "RU", - Name: "Russian Federation", - Region: "EU-E", - ContinentCode: "EU", - Center: Coordinates{Latitude: 61.000000, Longitude: 105.000000}, + Name: "Russian Federation", + Continent: ContinentInfo{Region: "EU-E"}, + Center: Coordinates{Latitude: 61.000000, Longitude: 105.000000}, }, "DZ": { - ID: "DZ", - Name: "Algeria", - Region: "AF-N", - ContinentCode: "AF", - Center: Coordinates{Latitude: 28.000000, Longitude: 1.000000}, + Name: "Algeria", + Continent: ContinentInfo{Region: "AF-N"}, + Center: Coordinates{Latitude: 28.000000, Longitude: 1.000000}, }, "DO": { - ID: "DO", - Name: "Dominican Republic", - Region: "NA-E", - ContinentCode: "NA", - Center: Coordinates{Latitude: 18.000000, Longitude: -70.000000}, + Name: "Dominican Republic", + Continent: ContinentInfo{Region: "NA-E"}, + Center: Coordinates{Latitude: 18.000000, Longitude: -70.000000}, }, "SI": { - ID: "SI", - Name: "Slovenia", - Region: "EU-S", - ContinentCode: "EU", - Center: Coordinates{Latitude: 46.000000, Longitude: 14.000000}, + Name: "Slovenia", + Continent: ContinentInfo{Region: "EU-S"}, + Center: Coordinates{Latitude: 46.000000, Longitude: 14.000000}, }, "BZ": { - ID: "BZ", - Name: "Belize", - Region: "NA-S", - ContinentCode: "NA", - Center: Coordinates{Latitude: 17.000000, Longitude: -88.000000}, + Name: "Belize", + Continent: ContinentInfo{Region: "NA-S"}, + Center: Coordinates{Latitude: 17.000000, Longitude: -88.000000}, }, "DJ": { - ID: "DJ", - Name: "Djibouti", - Region: "AF-E", - ContinentCode: "AF", - Center: Coordinates{Latitude: 11.000000, Longitude: 42.000000}, + Name: "Djibouti", + Continent: ContinentInfo{Region: "AF-E"}, + Center: Coordinates{Latitude: 11.000000, Longitude: 42.000000}, }, "GN": { - ID: "GN", - Name: "Guinea", - Region: "AF-W", - ContinentCode: "AF", - Center: Coordinates{Latitude: 9.000000, Longitude: -9.000000}, + Name: "Guinea", + Continent: ContinentInfo{Region: "AF-W"}, + Center: Coordinates{Latitude: 9.000000, Longitude: -9.000000}, }, "VN": { - ID: "VN", - Name: "Viet Nam", - Region: "AS-SE", - ContinentCode: "AS", - Center: Coordinates{Latitude: 14.000000, Longitude: 108.000000}, + Name: "Viet Nam", + Continent: ContinentInfo{Region: "AS-SE"}, + Center: Coordinates{Latitude: 14.000000, Longitude: 108.000000}, }, "IR": { - ID: "IR", - Name: "Iran", - Region: "AS-S", - ContinentCode: "AS", - Center: Coordinates{Latitude: 32.000000, Longitude: 53.000000}, + Name: "Iran", + Continent: ContinentInfo{Region: "AS-S"}, + Center: Coordinates{Latitude: 32.000000, Longitude: 53.000000}, }, "KG": { - ID: "KG", - Name: "Kyrgyzstan", - Region: "AS-C", - ContinentCode: "AS", - Center: Coordinates{Latitude: 41.000000, Longitude: 74.000000}, + Name: "Kyrgyzstan", + Continent: ContinentInfo{Region: "AS-C"}, + Center: Coordinates{Latitude: 41.000000, Longitude: 74.000000}, }, "ML": { - ID: "ML", - Name: "Mali", - Region: "AF-W", - ContinentCode: "AF", - Center: Coordinates{Latitude: 17.000000, Longitude: -3.000000}, + Name: "Mali", + Continent: ContinentInfo{Region: "AF-W"}, + Center: Coordinates{Latitude: 17.000000, Longitude: -3.000000}, }, "GP": { - ID: "GP", - Name: "Guadeloupe", - Region: "NA-E", - ContinentCode: "NA", - Center: Coordinates{Latitude: 16.000000, Longitude: -62.000000}, + Name: "Guadeloupe", + Continent: ContinentInfo{Region: "NA-E"}, + Center: Coordinates{Latitude: 16.000000, Longitude: -62.000000}, }, "FI": { - ID: "FI", - Name: "Finland", - Region: "EU-N", - ContinentCode: "EU", - Center: Coordinates{Latitude: 61.000000, Longitude: 25.000000}, + Name: "Finland", + Continent: ContinentInfo{Region: "EU-N"}, + Center: Coordinates{Latitude: 61.000000, Longitude: 25.000000}, }, "UA": { - ID: "UA", - Name: "Ukraine", - Region: "EU-E", - ContinentCode: "EU", - Center: Coordinates{Latitude: 48.000000, Longitude: 31.000000}, + Name: "Ukraine", + Continent: ContinentInfo{Region: "EU-E"}, + Center: Coordinates{Latitude: 48.000000, Longitude: 31.000000}, }, "KP": { - ID: "KP", - Name: "North Korea (DPRK)", - Region: "AS-E", - ContinentCode: "AS", - Center: Coordinates{Latitude: 40.000000, Longitude: 127.000000}, + Name: "North Korea (DPRK)", + Continent: ContinentInfo{Region: "AS-E"}, + Center: Coordinates{Latitude: 40.000000, Longitude: 127.000000}, }, "BT": { - ID: "BT", - Name: "Bhutan", - Region: "AS-S", - ContinentCode: "AS", - Center: Coordinates{Latitude: 27.000000, Longitude: 90.000000}, + Name: "Bhutan", + Continent: ContinentInfo{Region: "AS-S"}, + Center: Coordinates{Latitude: 27.000000, Longitude: 90.000000}, }, "BG": { - ID: "BG", - Name: "Bulgaria", - Region: "EU-E", - ContinentCode: "EU", - Center: Coordinates{Latitude: 42.000000, Longitude: 25.000000}, + Name: "Bulgaria", + Continent: ContinentInfo{Region: "EU-E"}, + Center: Coordinates{Latitude: 42.000000, Longitude: 25.000000}, }, "MM": { - ID: "MM", - Name: "Myanmar", - Region: "AS-SE", - ContinentCode: "AS", - Center: Coordinates{Latitude: 21.000000, Longitude: 95.000000}, + Name: "Myanmar", + Continent: ContinentInfo{Region: "AS-SE"}, + Center: Coordinates{Latitude: 21.000000, Longitude: 95.000000}, }, "PK": { - ID: "PK", - Name: "Pakistan", - Region: "AS-S", - ContinentCode: "AS", - Center: Coordinates{Latitude: 30.000000, Longitude: 69.000000}, + Name: "Pakistan", + Continent: ContinentInfo{Region: "AS-S"}, + Center: Coordinates{Latitude: 30.000000, Longitude: 69.000000}, }, "KI": { - ID: "KI", - Name: "Kiribati", - Region: "OC-N", - ContinentCode: "OC", - Center: Coordinates{Latitude: -3.000000, Longitude: -168.000000}, + Name: "Kiribati", + Continent: ContinentInfo{Region: "OC-N"}, + Center: Coordinates{Latitude: -3.000000, Longitude: -168.000000}, }, "GL": { - ID: "GL", - Name: "Greenland", - Region: "NA-N", - ContinentCode: "NA", - Center: Coordinates{Latitude: 71.000000, Longitude: -42.000000}, + Name: "Greenland", + Continent: ContinentInfo{Region: "NA-N"}, + Center: Coordinates{Latitude: 71.000000, Longitude: -42.000000}, }, "PG": { - ID: "PG", - Name: "Papua New Guinea", - Region: "OC-C", - ContinentCode: "OC", - Center: Coordinates{Latitude: -6.000000, Longitude: 143.000000}, + Name: "Papua New Guinea", + Continent: ContinentInfo{Region: "OC-C"}, + Center: Coordinates{Latitude: -6.000000, Longitude: 143.000000}, }, "PF": { - ID: "PF", - Name: "French Polynesia", - Region: "OC-E", - ContinentCode: "OC", - Center: Coordinates{Latitude: -17.000000, Longitude: -149.000000}, + Name: "French Polynesia", + Continent: ContinentInfo{Region: "OC-E"}, + Center: Coordinates{Latitude: -17.000000, Longitude: -149.000000}, }, "VU": { - ID: "VU", - Name: "Vanuatu", - Region: "OC-C", - ContinentCode: "OC", - Center: Coordinates{Latitude: -15.000000, Longitude: 166.000000}, + Name: "Vanuatu", + Continent: ContinentInfo{Region: "OC-C"}, + Center: Coordinates{Latitude: -15.000000, Longitude: 166.000000}, }, "HT": { - ID: "HT", - Name: "Haiti", - Region: "NA-E", - ContinentCode: "NA", - Center: Coordinates{Latitude: 18.000000, Longitude: -72.000000}, + Name: "Haiti", + Continent: ContinentInfo{Region: "NA-E"}, + Center: Coordinates{Latitude: 18.000000, Longitude: -72.000000}, }, "SV": { - ID: "SV", - Name: "El Salvador", - Region: "NA-S", - ContinentCode: "NA", - Center: Coordinates{Latitude: 13.000000, Longitude: -88.000000}, + Name: "El Salvador", + Continent: ContinentInfo{Region: "NA-S"}, + Center: Coordinates{Latitude: 13.000000, Longitude: -88.000000}, }, "EC": { - ID: "EC", - Name: "Ecuador", - Region: "SA", - ContinentCode: "SA", - Center: Coordinates{Latitude: -1.000000, Longitude: -78.000000}, + Name: "Ecuador", + Continent: ContinentInfo{Region: "SA"}, + Center: Coordinates{Latitude: -1.000000, Longitude: -78.000000}, }, "KM": { - ID: "KM", - Name: "Comoros", - Region: "AF-E", - ContinentCode: "AF", - Center: Coordinates{Latitude: -11.000000, Longitude: 43.000000}, + Name: "Comoros", + Continent: ContinentInfo{Region: "AF-E"}, + Center: Coordinates{Latitude: -11.000000, Longitude: 43.000000}, }, "VI": { - ID: "VI", - Name: "Virgin Islands (U.S.)", - Region: "NA-E", - ContinentCode: "NA", - Center: Coordinates{Latitude: 18.000000, Longitude: -64.000000}, + Name: "Virgin Islands (U.S.)", + Continent: ContinentInfo{Region: "NA-E"}, + Center: Coordinates{Latitude: 18.000000, Longitude: -64.000000}, }, "YT": { - ID: "YT", - Name: "Mayotte", - Region: "AF-E", - ContinentCode: "AF", - Center: Coordinates{Latitude: -12.000000, Longitude: 45.000000}, + Name: "Mayotte", + Continent: ContinentInfo{Region: "AF-E"}, + Center: Coordinates{Latitude: -12.000000, Longitude: 45.000000}, }, "ET": { - ID: "ET", - Name: "Ethiopia", - Region: "AF-E", - ContinentCode: "AF", - Center: Coordinates{Latitude: 9.000000, Longitude: 40.000000}, + Name: "Ethiopia", + Continent: ContinentInfo{Region: "AF-E"}, + Center: Coordinates{Latitude: 9.000000, Longitude: 40.000000}, }, "JO": { - ID: "JO", - Name: "Jordan", - Region: "AS-W", - ContinentCode: "AS", - Center: Coordinates{Latitude: 30.000000, Longitude: 36.000000}, + Name: "Jordan", + Continent: ContinentInfo{Region: "AS-W"}, + Center: Coordinates{Latitude: 30.000000, Longitude: 36.000000}, }, "RE": { - ID: "RE", - Name: "Réunion", - Region: "AF-E", - ContinentCode: "AF", - Center: Coordinates{Latitude: -21.000000, Longitude: 55.000000}, + Name: "Réunion", + Continent: ContinentInfo{Region: "AF-E"}, + Center: Coordinates{Latitude: -21.000000, Longitude: 55.000000}, }, "NR": { - ID: "NR", - Name: "Nauru", - Region: "OC-N", - ContinentCode: "OC", - Center: Coordinates{Latitude: 0.000000, Longitude: 166.000000}, + Name: "Nauru", + Continent: ContinentInfo{Region: "OC-N"}, + Center: Coordinates{Latitude: 0.000000, Longitude: 166.000000}, }, "HK": { - ID: "HK", - Name: "Hong Kong", - Region: "AS-E", - ContinentCode: "AS", - Center: Coordinates{Latitude: 22.000000, Longitude: 114.000000}, + Name: "Hong Kong", + Continent: ContinentInfo{Region: "AS-E"}, + Center: Coordinates{Latitude: 22.000000, Longitude: 114.000000}, }, "AU": { - ID: "AU", - Name: "Australia", - Region: "OC-S", - ContinentCode: "OC", - Center: Coordinates{Latitude: -25.000000, Longitude: 133.000000}, + Name: "Australia", + Continent: ContinentInfo{Region: "OC-S"}, + Center: Coordinates{Latitude: -25.000000, Longitude: 133.000000}, }, "FO": { - ID: "FO", - Name: "Faroe Islands", - Region: "EU-N", - ContinentCode: "EU", - Center: Coordinates{Latitude: 61.000000, Longitude: -6.000000}, + Name: "Faroe Islands", + Continent: ContinentInfo{Region: "EU-N"}, + Center: Coordinates{Latitude: 61.000000, Longitude: -6.000000}, }, "IQ": { - ID: "IQ", - Name: "Iraq", - Region: "AS-W", - ContinentCode: "AS", - Center: Coordinates{Latitude: 33.000000, Longitude: 43.000000}, + Name: "Iraq", + Continent: ContinentInfo{Region: "AS-W"}, + Center: Coordinates{Latitude: 33.000000, Longitude: 43.000000}, }, "GE": { - ID: "GE", - Name: "Georgia", - Region: "AS-W", - ContinentCode: "AS", - Center: Coordinates{Latitude: 42.000000, Longitude: 43.000000}, + Name: "Georgia", + Continent: ContinentInfo{Region: "AS-W"}, + Center: Coordinates{Latitude: 42.000000, Longitude: 43.000000}, }, "UZ": { - ID: "UZ", - Name: "Uzbekistan", - Region: "AS-C", - ContinentCode: "AS", - Center: Coordinates{Latitude: 41.000000, Longitude: 64.000000}, + Name: "Uzbekistan", + Continent: ContinentInfo{Region: "AS-C"}, + Center: Coordinates{Latitude: 41.000000, Longitude: 64.000000}, }, "IN": { - ID: "IN", - Name: "India", - Region: "AS-S", - ContinentCode: "AS", - Center: Coordinates{Latitude: 20.000000, Longitude: 78.000000}, + Name: "India", + Continent: ContinentInfo{Region: "AS-S"}, + Center: Coordinates{Latitude: 20.000000, Longitude: 78.000000}, }, "MX": { - ID: "MX", - Name: "Mexico", - Region: "NA-S", - ContinentCode: "NA", - Center: Coordinates{Latitude: 23.000000, Longitude: -102.000000}, + Name: "Mexico", + Continent: ContinentInfo{Region: "NA-S"}, + Center: Coordinates{Latitude: 23.000000, Longitude: -102.000000}, }, "ER": { - ID: "ER", - Name: "Eritrea", - Region: "AF-E", - ContinentCode: "AF", - Center: Coordinates{Latitude: 15.000000, Longitude: 39.000000}, + Name: "Eritrea", + Continent: ContinentInfo{Region: "AF-E"}, + Center: Coordinates{Latitude: 15.000000, Longitude: 39.000000}, }, "AL": { - ID: "AL", - Name: "Albania", - Region: "EU-S", - ContinentCode: "EU", - Center: Coordinates{Latitude: 41.000000, Longitude: 20.000000}, + Name: "Albania", + Continent: ContinentInfo{Region: "EU-S"}, + Center: Coordinates{Latitude: 41.000000, Longitude: 20.000000}, }, "GY": { - ID: "GY", - Name: "Guyana", - Region: "SA", - ContinentCode: "SA", - Center: Coordinates{Latitude: 4.000000, Longitude: -58.000000}, + Name: "Guyana", + Continent: ContinentInfo{Region: "SA"}, + Center: Coordinates{Latitude: 4.000000, Longitude: -58.000000}, }, "CA": { - ID: "CA", - Name: "Canada", - Region: "NA-N", - ContinentCode: "NA", - Center: Coordinates{Latitude: 56.000000, Longitude: -106.000000}, + Name: "Canada", + Continent: ContinentInfo{Region: "NA-N"}, + Center: Coordinates{Latitude: 56.000000, Longitude: -106.000000}, }, "SY": { - ID: "SY", - Name: "Syrian Arab Republic", - Region: "AS-W", - ContinentCode: "AS", - Center: Coordinates{Latitude: 34.000000, Longitude: 38.000000}, + Name: "Syrian Arab Republic", + Continent: ContinentInfo{Region: "AS-W"}, + Center: Coordinates{Latitude: 34.000000, Longitude: 38.000000}, }, "SG": { - ID: "SG", - Name: "Singapore", - Region: "AS-SE", - ContinentCode: "AS", - Center: Coordinates{Latitude: 1.000000, Longitude: 103.000000}, + Name: "Singapore", + Continent: ContinentInfo{Region: "AS-SE"}, + Center: Coordinates{Latitude: 1.000000, Longitude: 103.000000}, }, "VG": { - ID: "VG", - Name: "Virgin Islands (British)", - Region: "NA-E", - ContinentCode: "NA", - Center: Coordinates{Latitude: 18.000000, Longitude: -64.000000}, + Name: "Virgin Islands (British)", + Continent: ContinentInfo{Region: "NA-E"}, + Center: Coordinates{Latitude: 18.000000, Longitude: -64.000000}, }, "MC": { - ID: "MC", - Name: "Monaco", - Region: "EU-W", - ContinentCode: "EU", - Center: Coordinates{Latitude: 43.000000, Longitude: 7.000000}, + Name: "Monaco", + Continent: ContinentInfo{Region: "EU-W"}, + Center: Coordinates{Latitude: 43.000000, Longitude: 7.000000}, }, "BM": { - ID: "BM", - Name: "Bermuda", - Region: "NA-N", - ContinentCode: "NA", - Center: Coordinates{Latitude: 32.000000, Longitude: -64.000000}, + Name: "Bermuda", + Continent: ContinentInfo{Region: "NA-N"}, + Center: Coordinates{Latitude: 32.000000, Longitude: -64.000000}, }, "SX": { - ID: "SX", - Name: "Sint Maarten", - Region: "NA-E", - ContinentCode: "NA", - Center: Coordinates{Latitude: 18.000000, Longitude: -63.000000}, + Name: "Sint Maarten", + Continent: ContinentInfo{Region: "NA-E"}, + Center: Coordinates{Latitude: 18.000000, Longitude: -63.000000}, }, "SR": { - ID: "SR", - Name: "Suriname", - Region: "SA", - ContinentCode: "SA", - Center: Coordinates{Latitude: 3.000000, Longitude: -56.000000}, + Name: "Suriname", + Continent: ContinentInfo{Region: "SA"}, + Center: Coordinates{Latitude: 3.000000, Longitude: -56.000000}, }, "MD": { - ID: "MD", - Name: "Moldova", - Region: "EU-E", - ContinentCode: "EU", - Center: Coordinates{Latitude: 47.000000, Longitude: 28.000000}, + Name: "Moldova", + Continent: ContinentInfo{Region: "EU-E"}, + Center: Coordinates{Latitude: 47.000000, Longitude: 28.000000}, }, "CZ": { - ID: "CZ", - Name: "Czechia", - Region: "EU-E", - ContinentCode: "EU", - Center: Coordinates{Latitude: 49.000000, Longitude: 15.000000}, + Name: "Czechia", + Continent: ContinentInfo{Region: "EU-E"}, + Center: Coordinates{Latitude: 49.000000, Longitude: 15.000000}, }, "GQ": { - ID: "GQ", - Name: "Equatorial Guinea", - Region: "AF-C", - ContinentCode: "AF", - Center: Coordinates{Latitude: 1.000000, Longitude: 10.000000}, + Name: "Equatorial Guinea", + Continent: ContinentInfo{Region: "AF-C"}, + Center: Coordinates{Latitude: 1.000000, Longitude: 10.000000}, }, "TF": { - ID: "TF", - Name: "French Southern Territories", - Region: "AF-E", - ContinentCode: "AF", - Center: Coordinates{Latitude: -49.000000, Longitude: 69.000000}, + Name: "French Southern Territories", + Continent: ContinentInfo{Region: "AF-E"}, + Center: Coordinates{Latitude: -49.000000, Longitude: 69.000000}, }, "CI": { - ID: "CI", - Name: "Côte d'Ivoire", - Region: "AF-W", - ContinentCode: "AF", - Center: Coordinates{Latitude: 7.000000, Longitude: -5.000000}, + Name: "Côte d'Ivoire", + Continent: ContinentInfo{Region: "AF-W"}, + Center: Coordinates{Latitude: 7.000000, Longitude: -5.000000}, }, "VA": { - ID: "VA", - Name: "Holy See", - Region: "EU-S", - ContinentCode: "EU", - Center: Coordinates{Latitude: 41.000000, Longitude: 12.000000}, + Name: "Holy See", + Continent: ContinentInfo{Region: "EU-S"}, + Center: Coordinates{Latitude: 41.000000, Longitude: 12.000000}, }, "SN": { - ID: "SN", - Name: "Senegal", - Region: "AF-W", - ContinentCode: "AF", - Center: Coordinates{Latitude: 14.000000, Longitude: -14.000000}, + Name: "Senegal", + Continent: ContinentInfo{Region: "AF-W"}, + Center: Coordinates{Latitude: 14.000000, Longitude: -14.000000}, }, "PR": { - ID: "PR", - Name: "Puerto Rico", - Region: "NA-E", - ContinentCode: "NA", - Center: Coordinates{Latitude: 18.000000, Longitude: -66.000000}, + Name: "Puerto Rico", + Continent: ContinentInfo{Region: "NA-E"}, + Center: Coordinates{Latitude: 18.000000, Longitude: -66.000000}, }, "ID": { - ID: "ID", - Name: "Indonesia", - Region: "AS-SE", - ContinentCode: "AS", - Center: Coordinates{Latitude: 0.000000, Longitude: 113.000000}, + Name: "Indonesia", + Continent: ContinentInfo{Region: "AS-SE"}, + Center: Coordinates{Latitude: 0.000000, Longitude: 113.000000}, }, "BS": { - ID: "BS", - Name: "Bahamas", - Region: "NA-E", - ContinentCode: "NA", - Center: Coordinates{Latitude: 25.000000, Longitude: -77.000000}, + Name: "Bahamas", + Continent: ContinentInfo{Region: "NA-E"}, + Center: Coordinates{Latitude: 25.000000, Longitude: -77.000000}, }, "CV": { - ID: "CV", - Name: "Cabo Verde", - Region: "AF-W", - ContinentCode: "AF", - Center: Coordinates{Latitude: 16.000000, Longitude: -24.000000}, + Name: "Cabo Verde", + Continent: ContinentInfo{Region: "AF-W"}, + Center: Coordinates{Latitude: 16.000000, Longitude: -24.000000}, }, "AD": { - ID: "AD", - Name: "Andorra", - Region: "EU-S", - ContinentCode: "EU", - Center: Coordinates{Latitude: 42.000000, Longitude: 1.000000}, + Name: "Andorra", + Continent: ContinentInfo{Region: "EU-S"}, + Center: Coordinates{Latitude: 42.000000, Longitude: 1.000000}, }, "SK": { - ID: "SK", - Name: "Slovakia", - Region: "EU-E", - ContinentCode: "EU", - Center: Coordinates{Latitude: 48.000000, Longitude: 19.000000}, + Name: "Slovakia", + Continent: ContinentInfo{Region: "EU-E"}, + Center: Coordinates{Latitude: 48.000000, Longitude: 19.000000}, }, "MV": { - ID: "MV", - Name: "Maldives", - Region: "AS-S", - ContinentCode: "AS", - Center: Coordinates{Latitude: 3.000000, Longitude: 73.000000}, + Name: "Maldives", + Continent: ContinentInfo{Region: "AS-S"}, + Center: Coordinates{Latitude: 3.000000, Longitude: 73.000000}, }, "ME": { - ID: "ME", - Name: "Montenegro", - Region: "EU-S", - ContinentCode: "EU", - Center: Coordinates{Latitude: 42.000000, Longitude: 19.000000}, + Name: "Montenegro", + Continent: ContinentInfo{Region: "EU-S"}, + Center: Coordinates{Latitude: 42.000000, Longitude: 19.000000}, }, "LK": { - ID: "LK", - Name: "Sri Lanka", - Region: "AS-S", - ContinentCode: "AS", - Center: Coordinates{Latitude: 7.000000, Longitude: 80.000000}, + Name: "Sri Lanka", + Continent: ContinentInfo{Region: "AS-S"}, + Center: Coordinates{Latitude: 7.000000, Longitude: 80.000000}, }, "KH": { - ID: "KH", - Name: "Cambodia", - Region: "AS-SE", - ContinentCode: "AS", - Center: Coordinates{Latitude: 12.000000, Longitude: 104.000000}, + Name: "Cambodia", + Continent: ContinentInfo{Region: "AS-SE"}, + Center: Coordinates{Latitude: 12.000000, Longitude: 104.000000}, }, "GR": { - ID: "GR", - Name: "Greece", - Region: "EU-S", - ContinentCode: "EU", - Center: Coordinates{Latitude: 39.000000, Longitude: 21.000000}, + Name: "Greece", + Continent: ContinentInfo{Region: "EU-S"}, + Center: Coordinates{Latitude: 39.000000, Longitude: 21.000000}, }, "SL": { - ID: "SL", - Name: "Sierra Leone", - Region: "AF-W", - ContinentCode: "AF", - Center: Coordinates{Latitude: 8.000000, Longitude: -11.000000}, + Name: "Sierra Leone", + Continent: ContinentInfo{Region: "AF-W"}, + Center: Coordinates{Latitude: 8.000000, Longitude: -11.000000}, }, "XK": { - ID: "XK", - Name: "Kosovo", - Region: "EU-E", - ContinentCode: "EU", - Center: Coordinates{Latitude: 42.000000, Longitude: 20.000000}, + Name: "Kosovo", + Continent: ContinentInfo{Region: "EU-E"}, + Center: Coordinates{Latitude: 42.000000, Longitude: 20.000000}, }, "TJ": { - ID: "TJ", - Name: "Tajikistan", - Region: "AS-C", - ContinentCode: "AS", - Center: Coordinates{Latitude: 38.000000, Longitude: 71.000000}, + Name: "Tajikistan", + Continent: ContinentInfo{Region: "AS-C"}, + Center: Coordinates{Latitude: 38.000000, Longitude: 71.000000}, }, "SE": { - ID: "SE", - Name: "Sweden", - Region: "EU-N", - ContinentCode: "EU", - Center: Coordinates{Latitude: 60.000000, Longitude: 18.000000}, + Name: "Sweden", + Continent: ContinentInfo{Region: "EU-N"}, + Center: Coordinates{Latitude: 60.000000, Longitude: 18.000000}, }, "GA": { - ID: "GA", - Name: "Gabon", - Region: "AF-C", - ContinentCode: "AF", - Center: Coordinates{Latitude: 0.000000, Longitude: 11.000000}, + Name: "Gabon", + Continent: ContinentInfo{Region: "AF-C"}, + Center: Coordinates{Latitude: 0.000000, Longitude: 11.000000}, }, "UY": { - ID: "UY", - Name: "Uruguay", - Region: "SA", - ContinentCode: "SA", - Center: Coordinates{Latitude: -32.000000, Longitude: -55.000000}, + Name: "Uruguay", + Continent: ContinentInfo{Region: "SA"}, + Center: Coordinates{Latitude: -32.000000, Longitude: -55.000000}, }, "MZ": { - ID: "MZ", - Name: "Mozambique", - Region: "AF-E", - ContinentCode: "AF", - Center: Coordinates{Latitude: -18.000000, Longitude: 35.000000}, + Name: "Mozambique", + Continent: ContinentInfo{Region: "AF-E"}, + Center: Coordinates{Latitude: -18.000000, Longitude: 35.000000}, }, "PA": { - ID: "PA", - Name: "Panama", - Region: "NA-S", - ContinentCode: "NA", - Center: Coordinates{Latitude: 8.000000, Longitude: -80.000000}, + Name: "Panama", + Continent: ContinentInfo{Region: "NA-S"}, + Center: Coordinates{Latitude: 8.000000, Longitude: -80.000000}, }, "SZ": { - ID: "SZ", - Name: "Eswatini", - Region: "AF-S", - ContinentCode: "AF", - Center: Coordinates{Latitude: -26.000000, Longitude: 31.000000}, + Name: "Eswatini", + Continent: ContinentInfo{Region: "AF-S"}, + Center: Coordinates{Latitude: -26.000000, Longitude: 31.000000}, }, "IL": { - ID: "IL", - Name: "Israel", - Region: "AS-W", - ContinentCode: "AS", - Center: Coordinates{Latitude: 31.000000, Longitude: 34.000000}, + Name: "Israel", + Continent: ContinentInfo{Region: "AS-W"}, + Center: Coordinates{Latitude: 31.000000, Longitude: 34.000000}, }, "GB": { - ID: "GB", - Name: "United Kingdom", - Region: "EU-N", - ContinentCode: "EU", - Center: Coordinates{Latitude: 55.000000, Longitude: -3.000000}, + Name: "United Kingdom", + Continent: ContinentInfo{Region: "EU-N"}, + Center: Coordinates{Latitude: 55.000000, Longitude: -3.000000}, }, "ES": { - ID: "ES", - Name: "Spain", - Region: "EU-S", - ContinentCode: "EU", - Center: Coordinates{Latitude: 40.000000, Longitude: -3.000000}, + Name: "Spain", + Continent: ContinentInfo{Region: "EU-S"}, + Center: Coordinates{Latitude: 40.000000, Longitude: -3.000000}, }, "RW": { - ID: "RW", - Name: "Rwanda", - Region: "AF-E", - ContinentCode: "AF", - Center: Coordinates{Latitude: -1.000000, Longitude: 29.000000}, + Name: "Rwanda", + Continent: ContinentInfo{Region: "AF-E"}, + Center: Coordinates{Latitude: -1.000000, Longitude: 29.000000}, }, "EH": { - ID: "EH", - Name: "Western Sahara", - Region: "AF-N", - ContinentCode: "AF", - Center: Coordinates{Latitude: 24.000000, Longitude: -12.000000}, + Name: "Western Sahara", + Continent: ContinentInfo{Region: "AF-N"}, + Center: Coordinates{Latitude: 24.000000, Longitude: -12.000000}, }, "MH": { - ID: "MH", - Name: "Marshall Islands", - Region: "OC-N", - ContinentCode: "OC", - Center: Coordinates{Latitude: 7.000000, Longitude: 171.000000}, + Name: "Marshall Islands", + Continent: ContinentInfo{Region: "OC-N"}, + Center: Coordinates{Latitude: 7.000000, Longitude: 171.000000}, }, "MQ": { - ID: "MQ", - Name: "Martinique", - Region: "NA-E", - ContinentCode: "NA", - Center: Coordinates{Latitude: 14.000000, Longitude: -61.000000}, + Name: "Martinique", + Continent: ContinentInfo{Region: "NA-E"}, + Center: Coordinates{Latitude: 14.000000, Longitude: -61.000000}, }, "CH": { - ID: "CH", - Name: "Switzerland", - Region: "EU-W", - ContinentCode: "EU", - Center: Coordinates{Latitude: 46.000000, Longitude: 8.000000}, + Name: "Switzerland", + Continent: ContinentInfo{Region: "EU-W"}, + Center: Coordinates{Latitude: 46.000000, Longitude: 8.000000}, }, "CN": { - ID: "CN", - Name: "China", - Region: "AS-E", - ContinentCode: "AS", - Center: Coordinates{Latitude: 35.000000, Longitude: 104.000000}, + Name: "China", + Continent: ContinentInfo{Region: "AS-E"}, + Center: Coordinates{Latitude: 35.000000, Longitude: 104.000000}, }, "TR": { - ID: "TR", - Name: "Turkey", - Region: "AS-W", - ContinentCode: "AS", - Center: Coordinates{Latitude: 38.000000, Longitude: 35.000000}, + Name: "Turkey", + Continent: ContinentInfo{Region: "AS-W"}, + Center: Coordinates{Latitude: 38.000000, Longitude: 35.000000}, }, "BW": { - ID: "BW", - Name: "Botswana", - Region: "AF-S", - ContinentCode: "AF", - Center: Coordinates{Latitude: -22.000000, Longitude: 24.000000}, + Name: "Botswana", + Continent: ContinentInfo{Region: "AF-S"}, + Center: Coordinates{Latitude: -22.000000, Longitude: 24.000000}, }, "SS": { - ID: "SS", - Name: "South Sudan", - Region: "AF-E", - ContinentCode: "AF", - Center: Coordinates{Latitude: 4.000000, Longitude: 31.000000}, + Name: "South Sudan", + Continent: ContinentInfo{Region: "AF-E"}, + Center: Coordinates{Latitude: 4.000000, Longitude: 31.000000}, }, } diff --git a/intel/geoip/country_info_test.go b/intel/geoip/country_info_test.go index 544ff440..57cb6e8f 100644 --- a/intel/geoip/country_info_test.go +++ b/intel/geoip/country_info_test.go @@ -1,6 +1,7 @@ package geoip import ( + "strings" "testing" ) @@ -8,21 +9,31 @@ func TestCountryInfo(t *testing.T) { t.Parallel() for key, country := range countries { - if key != country.ID { - t.Errorf("%s has a wrong ID of %q", key, country.ID) + if key != country.Code { + t.Errorf("%s has a wrong country code of %q", key, country.Code) } if country.Name == "" { t.Errorf("%s is missing name", key) } - if country.Region == "" { - t.Errorf("%s is missing region", key) - } - if country.ContinentCode == "" { + if country.Continent.Code == "" { t.Errorf("%s is missing continent", key) } + if country.Continent.Region == "" { + t.Errorf("%s is missing continent region", key) + } + if country.Continent.Name == "" { + t.Errorf("%s is missing continent name", key) + } + generatedContinentCode, _, _ := strings.Cut(country.Continent.Region, "-") + if country.Continent.Code != generatedContinentCode { + t.Errorf("%s is has wrong continent code or region", key) + } if country.Center.Latitude == 0 && country.Center.Longitude == 0 { t.Errorf("%s is missing coords", key) } + if country.Center.AccuracyRadius == 0 { + t.Errorf("%s is missing accuracy radius", key) + } // Generate map source from data: // fmt.Printf( diff --git a/intel/geoip/location.go b/intel/geoip/location.go index 281a3262..5295584e 100644 --- a/intel/geoip/location.go +++ b/intel/geoip/location.go @@ -18,13 +18,7 @@ const ( // Location holds information regarding the geographical and network location of an IP address. // TODO: We are currently re-using the Continent-Code for the region. Update this and all dependencies. type Location struct { - Continent struct { - Code string `maxminddb:"code"` - } `maxminddb:"continent"` - Country struct { - Name string - ISOCode string `maxminddb:"iso_code"` - } `maxminddb:"country"` + Country CountryInfo `maxminddb:"country"` Coordinates Coordinates `maxminddb:"location"` AutonomousSystemNumber uint `maxminddb:"autonomous_system_number"` AutonomousSystemOrganization string `maxminddb:"autonomous_system_organization"` @@ -96,10 +90,9 @@ const ( // EstimateNetworkProximity aims to calculate the distance between two network locations. Returns a proximity value between 0 (far away) and 100 (nearby). func (l *Location) EstimateNetworkProximity(to *Location) (proximity float32) { switch { - case l.Country.ISOCode != "" && l.Country.ISOCode == to.Country.ISOCode: + case l.Country.Code != "" && l.Country.Code == to.Country.Code: proximity += weightCountryMatch + weightRegionMatch + weightRegionalNeighborMatch - case l.Continent.Code != "" && l.Continent.Code == to.Continent.Code: - // FYI: This is the region code! + case l.Country.Continent.Region != "" && l.Country.Continent.Region == to.Country.Continent.Region: proximity += weightRegionMatch + weightRegionalNeighborMatch case l.IsRegionalNeighbor(to): proximity += weightRegionalNeighborMatch diff --git a/intel/geoip/regions.go b/intel/geoip/regions.go index 53d608ed..879da23d 100644 --- a/intel/geoip/regions.go +++ b/intel/geoip/regions.go @@ -6,11 +6,11 @@ import ( // IsRegionalNeighbor returns whether the supplied location is a regional neighbor. func (l *Location) IsRegionalNeighbor(other *Location) bool { - if l.Continent.Code == "" || other.Continent.Code == "" { + if l.Country.Continent.Region == "" || other.Country.Continent.Region == "" { return false } - if region, ok := regions[l.Continent.Code]; ok { - return utils.StringInSlice(region.Neighbors, other.Continent.Code) + if region, ok := regions[l.Country.Continent.Region]; ok { + return utils.StringInSlice(region.Neighbors, other.Country.Continent.Region) } return false } diff --git a/netenv/location.go b/netenv/location.go index 4e79997a..23de17ff 100644 --- a/netenv/location.go +++ b/netenv/location.go @@ -135,12 +135,8 @@ func (dl *DeviceLocation) IsMoreAccurateThan(other *DeviceLocation) bool { other.Location.AutonomousSystemNumber == 0: // Having an ASN is better than having none. return true - case dl.Location.Continent.Code != "" && - other.Location.Continent.Code == "": - // Having a Continent is better than having none. - return true - case dl.Location.Country.ISOCode != "" && - other.Location.Country.ISOCode == "": + case dl.Location.Country.Code != "" && + other.Location.Country.Code == "": // Having a Country is better than having none. return true case (dl.Location.Coordinates.Latitude != 0 || @@ -178,7 +174,13 @@ func (dl *DeviceLocation) String() string { dl.Location.Coordinates.Longitude, ) default: - return fmt.Sprintf("%s (AS%d in %s)", dl.IP, dl.Location.AutonomousSystemNumber, dl.Location.Country.ISOCode) + return fmt.Sprintf( + "%s (AS%d in %s - %s)", + dl.IP, + dl.Location.AutonomousSystemNumber, + dl.Location.Country.Name, + dl.Location.Country.Code, + ) } } @@ -255,7 +257,7 @@ func (dls *DeviceLocations) AddIP(ip net.IP, source DeviceLocationSource) (dl *D return nil, false } // Only use location if there is data for it. - if geoLoc.Country.ISOCode == "" { + if geoLoc.Country.Code == "" { return nil, false } loc.Location = geoLoc diff --git a/profile/endpoints/endpoint-country.go b/profile/endpoints/endpoint-country.go index ce1b0660..c8e1f6df 100644 --- a/profile/endpoints/endpoint-country.go +++ b/profile/endpoints/endpoint-country.go @@ -2,6 +2,7 @@ package endpoints import ( "context" + "fmt" "regexp" "strings" @@ -14,7 +15,7 @@ var countryRegex = regexp.MustCompile(`^[A-Z]{2}$`) type EndpointCountry struct { EndpointBase - Country string + CountryCode string } // Matches checks whether the given entity matches this endpoint definition. @@ -27,25 +28,29 @@ func (ep *EndpointCountry) Matches(ctx context.Context, entity *intel.Entity) (E return NoMatch, nil } - country, ok := entity.GetCountry(ctx) - if !ok { - return MatchError, ep.makeReason(ep, country, "country data not available to match") + countryInfo := entity.GetCountryInfo(ctx) + if countryInfo == nil { + return MatchError, ep.makeReason(ep, "", "country data not available to match") } - if country == ep.Country { - return ep.match(ep, entity, country, "IP is located in") + if ep.CountryCode == countryInfo.Code { + return ep.match( + ep, entity, + fmt.Sprintf("%s (%s)", countryInfo.Name, countryInfo.Code), + "IP is located in", + ) } return NoMatch, nil } func (ep *EndpointCountry) String() string { - return ep.renderPPP(ep.Country) + return ep.renderPPP(ep.CountryCode) } func parseTypeCountry(fields []string) (Endpoint, error) { if countryRegex.MatchString(fields[1]) { ep := &EndpointCountry{ - Country: strings.ToUpper(fields[1]), + CountryCode: strings.ToUpper(fields[1]), } return ep.parsePPP(ep, fields) }