Skip to content

Commit

Permalink
feat: add country code to geoip json output
Browse files Browse the repository at this point in the history
  • Loading branch information
zu1k committed Dec 11, 2023
1 parent 0eb07b4 commit 214d935
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pkg/geoip/geoip.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ func (g GeoIP) Find(query string, params ...string) (result fmt.Stringer, err er
}

result = Result{
Country: record.Country.Names[lang],
Area: record.City.Names[lang],
Country: record.Country.Names[lang],
CountryCode: record.Country.IsoCode,
Area: record.City.Names[lang],
}
return
}
Expand All @@ -59,8 +60,9 @@ func (db GeoIP) Name() string {
}

type Result struct {
Country string `json:"country"`
Area string `json:"area"`
Country string `json:"country"`
CountryCode string `json:"country_code"`
Area string `json:"area"`
}

func (r Result) String() string {
Expand Down

0 comments on commit 214d935

Please sign in to comment.