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

add json note

This commit is contained in:
M09Ic 2023-05-20 17:14:03 +08:00
parent d6d26f71f8
commit 36025d8f01
5 changed files with 15 additions and 15 deletions

View File

@ -31,8 +31,8 @@ type CDNReTuple struct {
} }
type CDNResult struct { type CDNResult struct {
Name string `yaml:"name"` Name string `yaml:"name" json:"name"`
Link string `yaml:"link"` Link string `yaml:"link" json:"link"`
} }
func (r CDNResult) String() string { func (r CDNResult) String() string {

View File

@ -49,20 +49,20 @@ 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],
City: record.City.Names[lang], Area: record.City.Names[lang],
} }
return return
} }
type Result struct { type Result struct {
Country string Country string `json:"country"`
City string Area string `json:"area"`
} }
func (r Result) String() string { func (r Result) String() string {
if r.City == "" { if r.Area == "" {
return r.Country return r.Country
} else { } else {
return fmt.Sprintf("%s %s", r.Country, r.City) return fmt.Sprintf("%s %s", r.Country, r.Area)
} }
} }

View File

@ -51,9 +51,9 @@ func (x IP2Location) Find(query string, params ...string) (result fmt.Stringer,
} }
type Result struct { type Result struct {
Country string Country string `json:"country"`
Region string Region string `json:"region"`
City string City string `json:"city"`
} }
func (r Result) String() string { func (r Result) String() string {

View File

@ -28,9 +28,9 @@ func NewIPIP(filePath string) (*IPIPFree, error) {
} }
type Result struct { type Result struct {
Country string Country string `json:"country"`
Region string Region string `json:"region"`
City string City string `json:"city"`
} }
func (r Result) String() string { func (r Result) String() string {

View File

@ -86,8 +86,8 @@ func (r *Reader) readString(seek bool) string {
} }
type Result struct { type Result struct {
Country string Country string `json:"country"`
Area string Area string `json:"area"`
} }
func (r *Result) DecodeGBK() *Result { func (r *Result) DecodeGBK() *Result {