Skip to content

Commit

Permalink
dont waste region query on 0.0.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
czarcas7ic committed Jun 25, 2024
1 parent 818ae4b commit 8f730bd
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions p2p/switch.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ func GetRegionFromIP(ip string) (string, error) {
var url string
if ip == "" {
url = "http://ip-api.com/json/"
} else if ip == "0.0.0.0" {
return "", fmt.Errorf("invalid IP address: %s", ip)
} else {
url = fmt.Sprintf("http://ip-api.com/json/%s?fields=status,countryCode", ip)
}
Expand Down

0 comments on commit 8f730bd

Please sign in to comment.