Compare commits

...

5 Commits

3 changed files with 8 additions and 8 deletions

4
go.mod
View File

@ -1,5 +1,5 @@
module github.com/xiaoqidun/qqwry
go 1.16
go 1.20
require golang.org/x/text v0.3.6
require golang.org/x/text v0.9.0

5
go.sum
View File

@ -1,3 +1,2 @@
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=

View File

@ -6,8 +6,9 @@ import (
"errors"
"golang.org/x/text/encoding/simplifiedchinese"
"golang.org/x/text/transform"
"io/ioutil"
"io"
"net"
"os"
"strings"
"sync"
)
@ -39,7 +40,7 @@ func byte3ToUInt32(data []byte) uint32 {
func gb18030Decode(src []byte) string {
in := bytes.NewReader(src)
out := transform.NewReader(in, simplifiedchinese.GB18030.NewDecoder())
d, _ := ioutil.ReadAll(out)
d, _ := io.ReadAll(out)
return string(d)
}
@ -161,7 +162,7 @@ func LoadData(database []byte) {
// LoadFile 从文件加载IP数据库
func LoadFile(filepath string) (err error) {
data, err = ioutil.ReadFile(filepath)
data, err = os.ReadFile(filepath)
if err != nil {
return
}