ip2region

package
v1.2.12 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2022 License: Apache-2.0, MIT Imports: 6 Imported by: 7

Documentation

Index

Constants

View Source
const (
	INDEX_BLOCK_LENGTH  = 12
	TOTAL_HEADER_LENGTH = 8192
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Ip2Region

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

func New

func New(path string) (*Ip2Region, error)

func (*Ip2Region) BinarySearch

func (this *Ip2Region) BinarySearch(ipStr string) (ipInfo IpInfo, err error)

func (*Ip2Region) BtreeSearch

func (this *Ip2Region) BtreeSearch(ipStr string) (ipInfo IpInfo, err error)

func (*Ip2Region) Close

func (this *Ip2Region) Close()

func (*Ip2Region) InitBinarySearch added in v1.2.7

func (this *Ip2Region) InitBinarySearch() (err error)

func (*Ip2Region) InitBtreeSearch added in v1.2.7

func (this *Ip2Region) InitBtreeSearch() (err error)

func (*Ip2Region) InitMemorySearch added in v1.2.7

func (this *Ip2Region) InitMemorySearch() (err error)

func (*Ip2Region) MemorySearch

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

func (*Ip2Region) Reload added in v1.2.8

func (this *Ip2Region) Reload(newPath ...string) error

func (*Ip2Region) ResetBtreeSearch added in v1.2.7

func (this *Ip2Region) ResetBtreeSearch()

func (*Ip2Region) ResetMemoryAndBinarySearch added in v1.2.7

func (this *Ip2Region) ResetMemoryAndBinarySearch()

type IpInfo

type IpInfo struct {
	CityId   int64
	Country  string
	Region   string
	Province string
	City     string
	ISP      string
}

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