add new fields
This commit is contained in:
parent
1e3ba45665
commit
2b94bc01ec
@ -17,7 +17,11 @@ func NewReader() (*geoip2.Reader, error) {
|
|||||||
|
|
||||||
// GeoStruct -
|
// GeoStruct -
|
||||||
type GeoStruct struct {
|
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"`
|
Timezone string `json:"timezone"`
|
||||||
Location struct {
|
Location struct {
|
||||||
Latitude float64 `json:"latitude"`
|
Latitude float64 `json:"latitude"`
|
||||||
@ -37,5 +41,7 @@ func QueryGEO(input string) (geo *GeoStruct, err error) {
|
|||||||
geo.Timezone = record.Location.TimeZone
|
geo.Timezone = record.Location.TimeZone
|
||||||
geo.Location.Latitude = record.Location.Latitude
|
geo.Location.Latitude = record.Location.Latitude
|
||||||
geo.Location.Longitude = record.Location.Longitude
|
geo.Location.Longitude = record.Location.Longitude
|
||||||
|
geo.Country.Code = record.Country.IsoCode
|
||||||
|
geo.Country.Name = record.Country.Names["en"]
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user