mirror of
https://github.com/xiaoqidun/qqwry.git
synced 2023-06-27 14:38:22 +08:00
feat(升级依赖): 升级依赖并去掉废弃函数
This commit is contained in:
parent
afe166ae6e
commit
01491ac5e0
2
go.mod
2
go.mod
@ -2,4 +2,4 @@ module github.com/xiaoqidun/qqwry
|
||||
|
||||
go 1.20
|
||||
|
||||
require golang.org/x/text v0.7.0
|
||||
require golang.org/x/text v0.9.0
|
||||
|
4
go.sum
4
go.sum
@ -1,2 +1,2 @@
|
||||
golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=
|
||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
|
||||
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||
|
7
qqwry.go
7
qqwry.go
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user