ip2region

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FieldCountry 国家
	FieldCountry = "country"

	// FieldRegion 区域
	// 例如 华东/华北 等,在v2中基本为空
	FieldRegion = "region"

	// FieldProvince 省份
	FieldProvince = "province"

	// FieldCity 城市
	FieldCity = "city"

	// FieldISP 运营商
	FieldISP = "isp"
)
View Source
const (
	DBFormat = "ip2region"
	DBExt    = ".xdb"
)

Variables

CommonFieldsAlias 公共字段映射

FullFields 全字段列表

Functions

This section is empty.

Types

type Reader

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

Reader is a structure that provides functionalities to read from IP2Region IP database.

func NewReader

func NewReader(file string) (*Reader, error)

NewReader initializes a new instance of Reader.

func (*Reader) Close

func (r *Reader) Close() error

Close closes the IP database.

func (*Reader) Find

func (r *Reader) Find(ip net.IP) (*model.IPInfo, error)

Find retrieves IP information based on the given IP address.

func (*Reader) Meta

func (r *Reader) Meta() *model.Meta

Meta returns the meta-information of the IP database.

func (*Reader) SetOption

func (r *Reader) SetOption(option interface{}) error

SetOption configures the Reader with the provided option.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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