ipToAddr

package
v0.0.0-...-f5e84f7 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IpStrToLong

func IpStrToLong(ip string) (ipNum int64, err error)

将ip 转化 好进行对比

func IpToLong

func IpToLong(b []byte) int64

将[]byte 类型的ip进行转化

func ToLong

func ToLong(b []byte) int64

将[]byte 进行转化,获取到文件的index 对应偏移量

Types

type IpInfoExt

type IpInfoExt struct {
	Match bool   `json:"match" comment:"是否匹配到ip地址"`
	Ip    string `json:"ip" comment:"ip地址"`
	City  string `json:"city" comment:"城市"`
	Area  string `json:"area" comment:"区域"`
}

type IpSt

type IpSt struct {
	FirstIndex int64
	LastIndex  int64
	TotalIP    int64
	// contains filtered or unexported fields
}

func (*IpSt) FindIp

func (this *IpSt) FindIp(ip string) (info IpInfoExt)

通过索引区获取到ip的偏移量,然后去纪录区获取纪录

func (*IpSt) GetContent

func (this *IpSt) GetContent(index int64) (string, int64)

通过偏移量获取到内容

func (*IpSt) GetRecord

func (this *IpSt) GetRecord(dataIndex int64) (string, string)

获取及录取的内容

func (*IpSt) Init

func (this *IpSt) Init(filePath string) (err error)

Jump to

Keyboard shortcuts

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