Documentation ¶ Index ¶ func IpStrToLong(ip string) (ipNum int64, err error) func IpToLong(b []byte) int64 func ToLong(b []byte) int64 type IpInfoExt type IpSt func (this *IpSt) FindIp(ip string) (info IpInfoExt) func (this *IpSt) GetContent(index int64) (string, int64) func (this *IpSt) GetRecord(dataIndex int64) (string, string) func (this *IpSt) Init(filePath string) (err error) 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) Source Files ¶ View all Source files core.go main.go Click to show internal directories. Click to hide internal directories.