From d196a86e248a7f9dce65c98138e8d98493830b9b Mon Sep 17 00:00:00 2001 From: xiaoqidun Date: Thu, 21 Jan 2021 15:51:55 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E4=BF=AE=E6=AD=A3=E6=9F=A5=E8=AF=A2):=20?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E9=83=A8=E5=88=86IP=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- qqwry.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/qqwry.go b/qqwry.go index e041716..79a38b8 100644 --- a/qqwry.go +++ b/qqwry.go @@ -91,14 +91,14 @@ func QueryIP(queryIp string) (country string, area string, err error) { case redirectMode1: posC := byte3ToUInt32(data[posM+1 : posM+4]) mode = data[posC] - var cA uint32 = 0 + posCA := posC if mode == redirectMode2 { - cA = byte3ToUInt32(data[posC+1 : posC+4]) + posCA = byte3ToUInt32(data[posC+1 : posC+4]) posC += 4 } - for i := cA; i < dataLen; i++ { + for i := posCA; i < dataLen; i++ { if data[i] == 0 { - country = string(data[cA:i]) + country = string(data[posCA:i]) break } } @@ -107,19 +107,19 @@ func QueryIP(queryIp string) (country string, area string, err error) { } areaPos = posC case redirectMode2: - cA := byte3ToUInt32(data[posM+1 : posM+4]) - for i := cA; i < dataLen; i++ { + posCA := byte3ToUInt32(data[posM+1 : posM+4]) + for i := posCA; i < dataLen; i++ { if data[i] == 0 { - country = string(data[cA:i]) + country = string(data[posCA:i]) break } } areaPos = offset + 8 default: - cA := offset + 4 - for i := cA; i < dataLen; i++ { + posCA := offset + 4 + for i := posCA; i < dataLen; i++ { if data[i] == 0 { - country = string(data[cA:i]) + country = string(data[posCA:i]) break } }