Skip to content

Commit

Permalink
Merge pull request #97 from ethpandaops/fix/registered-country
Browse files Browse the repository at this point in the history
fix(server): maxmind geoip country
  • Loading branch information
Savid authored Mar 8, 2023
2 parents a5d4c0b + 6aeb4c1 commit 3f2e6d5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ server.yaml
discovery.yaml
mimicry.yaml
dist
GeoLite2-ASN.mmdb
GeoLite2-City.mmdb
4 changes: 2 additions & 2 deletions pkg/server/geoip/maxmind/database/city.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ type City struct {
}

type LookupCity struct {
RegisteredCountry struct {
Country struct {
ISOCode string `maxminddb:"iso_code"`
Names struct {
EN string `maxminddb:"en"`
} `maxminddb:"names"`
} `maxminddb:"registered_country"`
} `maxminddb:"country"`
Continent struct {
Code string `maxminddb:"code"`
} `maxminddb:"continent"`
Expand Down
4 changes: 2 additions & 2 deletions pkg/server/geoip/maxmind/maxmind.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ func (m *Maxmind) LookupIP(ctx context.Context, ip net.IP) (*lookup.Result, erro

if city != nil {
result.CityName = city.City.Names.EN
result.CountryName = city.RegisteredCountry.Names.EN
result.CountryCode = city.RegisteredCountry.ISOCode
result.CountryName = city.Country.Names.EN
result.CountryCode = city.Country.ISOCode
result.ContinentCode = city.Continent.Code
result.Latitude = city.Location.Latitude
result.Longitude = city.Location.Longitude
Expand Down

0 comments on commit 3f2e6d5

Please sign in to comment.