ip2region

package
v0.0.0-...-05c9766 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IndexBlockLength = 12
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Ip2Region

type Ip2Region struct {
	// contains filtered or unexported fields
}

func (*Ip2Region) MemorySearch

func (r *Ip2Region) MemorySearch(ipStr string) (ipInfo IpInfo, err error)

MemorySearch memory算法:整个数据库全部载入内存,单次查询都在0.1x毫秒内

type IpInfo

type IpInfo struct {
	IP       string `json:"ip,omitempty"`       // 输入的ip地址
	CityID   int64  `json:"city_id,omitempty"`  // 城市ID
	Country  string `json:"country,omitempty"`  // 国家
	Region   string `json:"region,omitempty"`   // 区域
	Province string `json:"province,omitempty"` // 省份
	City     string `json:"city,omitempty"`     // 城市
	ISP      string `json:"isp,omitempty"`      // 运营商
}

func (IpInfo) String

func (ip IpInfo) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL