ip2region_test.go 404 B

1234567891011121314151617181920212223242526
  1. package ip2region
  2. import (
  3. "fmt"
  4. "github.com/lionsoul2014/ip2region/binding/golang/ip2region"
  5. "miads/adslib"
  6. "testing"
  7. )
  8. var r *ip2region.Ip2Region
  9. func init() {
  10. var err error
  11. r, err = ip2region.New(adslib.GetConf().Ip2RegionFile)
  12. if err != nil {
  13. fmt.Printf("%s", err)
  14. }
  15. }
  16. func BenchmarkIp2Region(b *testing.B) {
  17. ip := "36.161.36.225"
  18. for i := 0; i < b.N; i++ {
  19. r.MemorySearch(ip)
  20. }
  21. }