feat(升级依赖): 升级依赖并去掉废弃函数

This commit is contained in:
2023-04-07 15:32:15 +08:00
parent afe166ae6e
commit 01491ac5e0
3 changed files with 7 additions and 6 deletions

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
}