离线IP地址定位库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
王江炜 4659f503ff feat: 更新ip数据库 3 months ago
data feat: 更新ip数据库 3 months ago
.gitignore Initial commit 3 months ago
LICENSE Initial commit 3 months ago
README.md feat: 离线IP地址定位库 3 months ago
go.mod feat: 离线IP地址定位库 3 months ago
ip2region.go feat: 更新ip数据库 3 months ago
ip2region_test.go feat: 离线IP地址定位库 3 months ago

README.md

ip2region

离线IP地址定位库

使用

package main

import (
	"fmt"

	"devgit.starschina.com/wangjiangwei/ip2region"
)

func main() {
	region, err := ip2region.New("./data/ip2region.db")
	defer region.Close()
	if err != nil {
		fmt.Println(err)
		return
	}
	ip, err := region.MemorySearch("127.0.0.1")
	fmt.Println(ip, err)
	ip, err = region.BinarySearch("127.0.0.1")
	fmt.Println(ip, err)
	ip, err = region.BtreeSearch("127.0.0.1")
	fmt.Println(ip, err)
}