parent
23e408ea47
commit
b5ab613e4c
@ -0,0 +1,18 @@
|
|||||||
|
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
|
||||||
|
}
|
Loading…
Reference in new issue