package ip2region import ( "fmt" "github.com/lionsoul2014/ip2region/binding/golang/ip2region" ) func Ip2Region(ip string) (*ip2region.IpInfo, error) { fmt.Println("err") region, err := ip2region.New("./ip2region.db") defer region.Close() if err != nil { fmt.Println(err) return nil, err } ipInfo, err := region.BtreeSearch(ip) if err != nil { return nil, err } return &ipInfo, nil }