代码拉取完成,页面将自动刷新
package ip4region
import (
"strings"
)
func (ip IPInfo) String() string {
return ip.Country + "|" + ip.Region + "|" + ip.Province + "|" + ip.City + "|" + ip.ISP
}
func getIPInfo(line []byte) IPInfo {
lineSlice := strings.Split(string(line), "|")
ipInfo := IPInfo{}
length := len(lineSlice)
//ipInfo.CityId = cityId
if length < 5 {
for i := 0; i <= 5-length; i++ {
lineSlice = append(lineSlice, "")
}
}
ipInfo.Country = lineSlice[0]
ipInfo.Region = lineSlice[1]
ipInfo.Province = lineSlice[2]
ipInfo.City = lineSlice[3]
ipInfo.ISP = lineSlice[4]
return ipInfo
}
func getLong(b []byte, offset int64) int64 {
val := (int64(b[offset])<<24 |
int64(b[offset+1])<<16 |
int64(b[offset+2])<<8 |
int64(b[offset+3]))
return val
}
func (ip4 *IP4Region) getLong(offset int64) int64 {
val := (int64(ip4.dbBinStr[offset])<<24 |
int64(ip4.dbBinStr[offset+1])<<16 |
int64(ip4.dbBinStr[offset+2])<<8 |
int64(ip4.dbBinStr[offset+3]))
return val
}
func getLongLitte(b []byte, offset int64) int64 {
val := (int64(b[offset]) |
int64(b[offset+1])<<8 |
int64(b[offset+2])<<16 |
int64(b[offset+3])<<24)
return val
}
func (ip4 *IP4Region) getLongLitte(offset int64) int64 {
val := (int64(ip4.dbBinStr[offset]) |
int64(ip4.dbBinStr[offset+1])<<8 |
int64(ip4.dbBinStr[offset+2])<<16 |
int64(ip4.dbBinStr[offset+3])<<24)
return val
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。