You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
305 B
19 lines
305 B
4 years ago
|
package tools
|
||
|
|
||
|
import (
|
||
|
"github.com/ipipdotnet/ipdb-go"
|
||
|
)
|
||
|
|
||
|
func ParseIp(myip string)(*ipdb.CityInfo) {
|
||
|
db, err := ipdb.NewCity("./config/city.free.ipdb")
|
||
|
if err != nil {
|
||
|
return nil
|
||
|
}
|
||
|
db.Reload("./config/city.free.ipdb")
|
||
|
c,err :=db.FindInfo(myip, "CN")
|
||
|
if err != nil {
|
||
|
return nil
|
||
|
}
|
||
|
return c
|
||
|
}
|