Skip to content

Commit

Permalink
changing endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Mzack9999 committed Jun 21, 2023
1 parent 840d3da commit 8647c83
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ip/iputil.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"net/http"
"strconv"
"strings"
"time"

"github.com/projectdiscovery/utils/consts"
osutil "github.com/projectdiscovery/utils/os"
Expand Down Expand Up @@ -264,9 +265,10 @@ func AsIPV6CIDR(IPV6 string) string {
}

// WhatsMyIP attempts to obtain the external ip through public api
// Copied from https://github.com/projectdiscovery/naabu/blob/master/v2/pkg/scan/externalip.go
func WhatsMyIP() (string, error) {
req, err := http.NewRequestWithContext(context.Background(), http.MethodGet, "https://api.ipify.org?format=text", nil)
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
defer cancel()
req, err := http.NewRequestWithContext(ctx, http.MethodGet, "https://checkip.amazonaws.com/", nil)
if err != nil {
return "", nil
}
Expand Down

0 comments on commit 8647c83

Please sign in to comment.