Ejemplo n.º 1
0
func init() {
	// replace iplocFilePath to your iploc.dat path
	iplocFilePath, _ := filepath.Abs("src/github.com/slene/iploc/iploc.dat")

	// simple set a true param can preload all ipinfo
	// need allocate more memory > 30M
	// and speed can grow up about 40 percent than not preload
	iploc.IpLocInit(iplocFilePath, true)

	// read iploc.dat into memory, not preload
	// iploc.IpLocInit(iplocFilePath)
}
Ejemplo n.º 2
0
func init() {
	pwd, _ := os.Getwd()
	iplocFilePath, _ := filepath.Abs(filepath.Join(pwd, "src/github.com/slene/iploc/iploc.dat"))
	iploc.IpLocInit(iplocFilePath)
}