diff --git a/docs/file.md b/docs/file.md index 8ab82d0..4fe926e 100644 --- a/docs/file.md +++ b/docs/file.md @@ -7,7 +7,6 @@ go-cqhttp 默认生成的文件树如下所示: ├── go-cqhttp ├── config.json ├── device.json -├── servers.bin ├── logs │ └── xx-xx-xx.log └── data @@ -21,7 +20,6 @@ go-cqhttp 默认生成的文件树如下所示: | go-cqhttp | go-cqhttp可执行文件 | | config.json | 运行配置文件 | | device.json | 虚拟设备配置文件 | -| servers.bin | 储存QQ服务器地址 | | logs | 日志存放目录 | | data | 数据目录 | | data/images | 图片缓存目录 | diff --git a/main.go b/main.go index 919849e..4e8d99b 100644 --- a/main.go +++ b/main.go @@ -10,7 +10,6 @@ import ( "image" "io" "io/ioutil" - "net" "os" "os/signal" "path" @@ -237,47 +236,8 @@ func main() { } }) cli.OnServerUpdated(func(bot *client.QQClient, e *client.ServerUpdatedEvent) { - log.Infof("收到服务器地址更新通知, 将在下一次重连时应用. 地址信息已储存到 servers.bin 文件") - _ = ioutil.WriteFile("servers.bin", binary.NewWriterF(func(w *binary.Writer) { - w.WriteUInt16(func() (c uint16) { - for _, s := range e.Servers { - if !strings.Contains(s.Server, "com") { - c++ - } - } - return - }()) - for _, s := range e.Servers { - if !strings.Contains(s.Server, "com") { - w.WriteString(s.Server) - w.WriteUInt16(uint16(s.Port)) - } - } - }), 0644) + log.Infof("收到服务器地址更新通知, 将在下一次重连时应用. ") }) - if global.PathExists("servers.bin") { - if data, err := ioutil.ReadFile("servers.bin"); err == nil { - func() { - defer func() { - if pan := recover(); pan != nil { - log.Error("读取服务器地址时出现错误: ", pan) - } - }() - r := binary.NewReader(data) - var addr []*net.TCPAddr - l := r.ReadUInt16() - for i := 0; i < int(l); i++ { - addr = append(addr, &net.TCPAddr{ - IP: net.ParseIP(r.ReadString()), - Port: int(r.ReadUInt16()), - }) - } - if len(addr) > 0 { - cli.SetCustomServer(addr) - } - }() - } - } rsp, err := cli.Login() for { global.Check(err)