mirror of
https://github.com/xiaoqidun/qqwry.git
synced 2023-06-27 14:38:22 +08:00
fix(修正查询): 修正部分IP查询错误
This commit is contained in:
parent
c30cc99c4e
commit
d196a86e24
20
qqwry.go
20
qqwry.go
@ -91,14 +91,14 @@ func QueryIP(queryIp string) (country string, area string, err error) {
|
|||||||
case redirectMode1:
|
case redirectMode1:
|
||||||
posC := byte3ToUInt32(data[posM+1 : posM+4])
|
posC := byte3ToUInt32(data[posM+1 : posM+4])
|
||||||
mode = data[posC]
|
mode = data[posC]
|
||||||
var cA uint32 = 0
|
posCA := posC
|
||||||
if mode == redirectMode2 {
|
if mode == redirectMode2 {
|
||||||
cA = byte3ToUInt32(data[posC+1 : posC+4])
|
posCA = byte3ToUInt32(data[posC+1 : posC+4])
|
||||||
posC += 4
|
posC += 4
|
||||||
}
|
}
|
||||||
for i := cA; i < dataLen; i++ {
|
for i := posCA; i < dataLen; i++ {
|
||||||
if data[i] == 0 {
|
if data[i] == 0 {
|
||||||
country = string(data[cA:i])
|
country = string(data[posCA:i])
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -107,19 +107,19 @@ func QueryIP(queryIp string) (country string, area string, err error) {
|
|||||||
}
|
}
|
||||||
areaPos = posC
|
areaPos = posC
|
||||||
case redirectMode2:
|
case redirectMode2:
|
||||||
cA := byte3ToUInt32(data[posM+1 : posM+4])
|
posCA := byte3ToUInt32(data[posM+1 : posM+4])
|
||||||
for i := cA; i < dataLen; i++ {
|
for i := posCA; i < dataLen; i++ {
|
||||||
if data[i] == 0 {
|
if data[i] == 0 {
|
||||||
country = string(data[cA:i])
|
country = string(data[posCA:i])
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
areaPos = offset + 8
|
areaPos = offset + 8
|
||||||
default:
|
default:
|
||||||
cA := offset + 4
|
posCA := offset + 4
|
||||||
for i := cA; i < dataLen; i++ {
|
for i := posCA; i < dataLen; i++ {
|
||||||
if data[i] == 0 {
|
if data[i] == 0 {
|
||||||
country = string(data[cA:i])
|
country = string(data[posCA:i])
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user