getMinecraftServerStatus 获取Minecraft服务器状态
(addr string)
| 47 | |
| 48 | // getMinecraftServerStatus 获取Minecraft服务器状态 |
| 49 | func getMinecraftServerStatus(addr string) (*serverPingAndListResp, error) { |
| 50 | var s serverPingAndListResp |
| 51 | resp, delay, err := bot.PingAndListTimeout(addr, time.Second*5) |
| 52 | if err != nil { |
| 53 | // logrus.Errorln(logPrefix+"PingAndList error: ", err) |
| 54 | return nil, err |
| 55 | } |
| 56 | err = json.Unmarshal(resp, &s) |
| 57 | if err != nil { |
| 58 | // logrus.Errorln(logPrefix+"Parse json response fail: ", err) |
| 59 | return nil, err |
| 60 | } |
| 61 | s.Delay = delay |
| 62 | return &s, nil |
| 63 | } |
no outgoing calls