优化ip插件
This commit is contained in:
parent
c7ce482511
commit
5def1cd668
1 changed files with 6 additions and 2 deletions
|
@ -52,12 +52,16 @@ func (a *Ip) GetMsg() string {
|
||||||
} else {
|
} else {
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
body, err := io.ReadAll(resp.Body)
|
body, err := io.ReadAll(resp.Body)
|
||||||
// println(string(body))
|
println(string(body))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("err:", err)
|
fmt.Println("err:", err)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
var resp_data map[string]interface{}
|
var resp_data map[string]interface{}
|
||||||
json.Unmarshal(body, &resp_data)
|
err := json.Unmarshal(body, &resp_data)
|
||||||
|
if err != nil {
|
||||||
|
return "DNS解析失败!"
|
||||||
|
}
|
||||||
ip = resp_data["data"].(map[string]interface{})["ip"].(string)
|
ip = resp_data["data"].(map[string]interface{})["ip"].(string)
|
||||||
// print("ip: ", ip)
|
// print("ip: ", ip)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue