Skip to content

Commit

Permalink
fix: bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yzy613 committed Dec 25, 2022
1 parent b6fc0fc commit 724a4ff
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
10 changes: 7 additions & 3 deletions cmd/ddns-watchdog-client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ func check() {
if ipv6 != client.Client.LatestIPv6 {
client.Client.LatestIPv6 = ipv6
}
wg := sync.WaitGroup{}
var wg = sync.WaitGroup{}
if client.Client.Center.Enable {
accessCenter(ipv4, ipv6)
} else {
Expand Down Expand Up @@ -271,7 +271,11 @@ func accessCenter(ipv4, ipv6 string) {
}

// 发送请求
req, err := http.NewRequest("POST", client.Client.Center.APIUrl, bytes.NewReader(reqJson))
req, err := http.NewRequest(http.MethodPost, client.Client.Center.APIUrl, bytes.NewReader(reqJson))
if err != nil {
log.Println(err)
return
}
resp, err := hc.Do(req)
if err != nil {
log.Println(err)
Expand All @@ -294,7 +298,7 @@ func accessCenter(ipv4, ipv6 string) {
return
}
if len(respBodyJson) > 0 {
respBody := common.GeneralResp{}
var respBody = common.GeneralResp{}
err = json.Unmarshal(respBodyJson, &respBody)
if err != nil {
log.Println(err)
Expand Down
2 changes: 1 addition & 1 deletion internal/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (conf *client) GetLatestVersion() (str string) {
if err != nil {
return "N/A (数据包错误)"
}
recv := common.GetIPResp{}
var recv = common.GetIPResp{}
err = json.Unmarshal(recvJson, &recv)
if err != nil {
return "N/A (数据包错误)"
Expand Down
2 changes: 1 addition & 1 deletion internal/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (conf *server) GetLatestVersion() (str string) {
if err != nil {
return "N/A (数据包错误)"
}
recv := common.GetIPResp{}
var recv = common.GetIPResp{}
err = json.Unmarshal(recvJson, &recv)
if err != nil {
return "N/A (数据包错误)"
Expand Down

0 comments on commit 724a4ff

Please sign in to comment.