1234567891011121314151617181920212223242526 |
- package ip2region
- import (
- "fmt"
- "github.com/lionsoul2014/ip2region/binding/golang/ip2region"
- "miads/adslib"
- "testing"
- )
- var r *ip2region.Ip2Region
- func init() {
- var err error
- r, err = ip2region.New(adslib.GetConf().Ip2RegionFile)
- if err != nil {
- fmt.Printf("%s", err)
- }
- }
- func BenchmarkIp2Region(b *testing.B) {
- ip := "36.161.36.225"
- for i := 0; i < b.N; i++ {
- r.MemorySearch(ip)
- }
- }
|