diff --git a/pkg/cdn/cdn.go b/pkg/cdn/cdn.go index 5db5590..eba97c5 100644 --- a/pkg/cdn/cdn.go +++ b/pkg/cdn/cdn.go @@ -31,8 +31,8 @@ type CDNReTuple struct { } type CDNResult struct { - Name string `yaml:"name"` - Link string `yaml:"link"` + Name string `yaml:"name" json:"name"` + Link string `yaml:"link" json:"link"` } func (r CDNResult) String() string { diff --git a/pkg/geoip/geoip.go b/pkg/geoip/geoip.go index 2a0f72f..e6f817d 100644 --- a/pkg/geoip/geoip.go +++ b/pkg/geoip/geoip.go @@ -49,20 +49,20 @@ func (g GeoIP) Find(query string, params ...string) (result fmt.Stringer, err er result = Result{ Country: record.Country.Names[lang], - City: record.City.Names[lang], + Area: record.City.Names[lang], } return } type Result struct { - Country string - City string + Country string `json:"country"` + Area string `json:"area"` } func (r Result) String() string { - if r.City == "" { + if r.Area == "" { return r.Country } else { - return fmt.Sprintf("%s %s", r.Country, r.City) + return fmt.Sprintf("%s %s", r.Country, r.Area) } } diff --git a/pkg/ip2location/ip2location.go b/pkg/ip2location/ip2location.go index 1e1cd1e..11f9f0b 100644 --- a/pkg/ip2location/ip2location.go +++ b/pkg/ip2location/ip2location.go @@ -51,9 +51,9 @@ func (x IP2Location) Find(query string, params ...string) (result fmt.Stringer, } type Result struct { - Country string - Region string - City string + Country string `json:"country"` + Region string `json:"region"` + City string `json:"city"` } func (r Result) String() string { diff --git a/pkg/ipip/ipip.go b/pkg/ipip/ipip.go index ec537ed..eabb630 100644 --- a/pkg/ipip/ipip.go +++ b/pkg/ipip/ipip.go @@ -28,9 +28,9 @@ func NewIPIP(filePath string) (*IPIPFree, error) { } type Result struct { - Country string - Region string - City string + Country string `json:"country"` + Region string `json:"region"` + City string `json:"city"` } func (r Result) String() string { diff --git a/pkg/wry/wry.go b/pkg/wry/wry.go index 506354f..9d72772 100644 --- a/pkg/wry/wry.go +++ b/pkg/wry/wry.go @@ -86,8 +86,8 @@ func (r *Reader) readString(seek bool) string { } type Result struct { - Country string - Area string + Country string `json:"country"` + Area string `json:"area"` } func (r *Result) DecodeGBK() *Result {