diff --git a/module/geoip/geoip.go b/module/geoip/geoip.go index 57dba0b..c66331d 100644 --- a/module/geoip/geoip.go +++ b/module/geoip/geoip.go @@ -17,7 +17,11 @@ func NewReader() (*geoip2.Reader, error) { // GeoStruct - type GeoStruct struct { - City string `json:"city"` + City string `json:"city"` + Country struct { + Name string `json:"name"` + Code string `json:"code"` + } `json:"country"` Timezone string `json:"timezone"` Location struct { Latitude float64 `json:"latitude"` @@ -37,5 +41,7 @@ func QueryGEO(input string) (geo *GeoStruct, err error) { geo.Timezone = record.Location.TimeZone geo.Location.Latitude = record.Location.Latitude geo.Location.Longitude = record.Location.Longitude + geo.Country.Code = record.Country.IsoCode + geo.Country.Name = record.Country.Names["en"] return }