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 {
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 {

View File

@ -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)
}
}

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {