ip2region

package
v1.0.177 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IndexBlockLength = 12
)

Variables

This section is empty.

Functions

func OnlineDownload added in v1.0.52

func OnlineDownload()

Types

type Client added in v1.0.52

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

func New added in v1.0.52

func New(filepath string) (*Client, error)

func NewBuff added in v1.0.161

func NewBuff(file []byte) (*Client, error)

func (*Client) Query added in v1.0.52

func (c *Client) Query(ipAddress net.IP) (result QueryResult, err error)

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

func (*Client) QueryIP added in v1.0.161

func (c *Client) QueryIP(ipAddressStr string) (result QueryResult, err error)

QueryIP ip地址查询对应归属地信息

type QueryResult added in v1.0.52

type QueryResult struct {
	Ip       string `json:"ip,omitempty"`       // ip
	CityId   int64  `json:"city_id,omitempty"`  // 城市代码
	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 (QueryResult) String added in v1.0.52

func (ip QueryResult) String() string

Jump to

Keyboard shortcuts

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