Skip to content

Commit

Permalink
chore: improve conf.GetNodeIPFromAPIs()
Browse files Browse the repository at this point in the history
  • Loading branch information
fufuok committed Dec 1, 2024
1 parent a4a113b commit 0fae2cc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion config/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,10 @@ func GetNodeIPFromAPIs(ipapi string, timeout ...time.Duration) string {
go func() {
resp, err := req.DefaultClient().Clone().SetTimeout(dur).R().SetContext(ctx).Get(api)
if err == nil && resp.IsSuccessState() {
ipChan <- strings.TrimSpace(resp.String())
ip := strings.TrimSpace(resp.String())
if utils.IsIP(ip) {
ipChan <- ip
}
}
}()
}
Expand Down

0 comments on commit 0fae2cc

Please sign in to comment.