1
0
mirror of https://github.com/zu1k/nali.git synced 2025-02-02 10:22:41 +08:00

feat: add country code to geoip json output

This commit is contained in:
zu1k 2023-12-11 09:52:39 +08:00
parent 0eb07b49ad
commit 214d935a25

View File

@ -48,8 +48,9 @@ func (g GeoIP) Find(query string, params ...string) (result fmt.Stringer, err er
} }
result = Result{ result = Result{
Country: record.Country.Names[lang], Country: record.Country.Names[lang],
Area: record.City.Names[lang], CountryCode: record.Country.IsoCode,
Area: record.City.Names[lang],
} }
return return
} }
@ -59,8 +60,9 @@ func (db GeoIP) Name() string {
} }
type Result struct { type Result struct {
Country string `json:"country"` Country string `json:"country"`
Area string `json:"area"` CountryCode string `json:"country_code"`
Area string `json:"area"`
} }
func (r Result) String() string { func (r Result) String() string {