|
@@ -10,6 +10,7 @@ import (
|
|
|
"time"
|
|
|
|
|
|
"github.com/gravitl/netmaker/config"
|
|
|
+ "github.com/gravitl/netmaker/logger"
|
|
|
"github.com/gravitl/netmaker/models"
|
|
|
)
|
|
|
|
|
@@ -427,7 +428,16 @@ func GetPublicIP() (string, error) {
|
|
|
var err error
|
|
|
|
|
|
iplist := []string{"https://ip.server.gravitl.com", "https://ifconfig.me", "https://api.ipify.org", "https://ipinfo.io/ip"}
|
|
|
+ publicIpService := os.Getenv("PUBLIC_IP_SERVICE")
|
|
|
+ if publicIpService != "" {
|
|
|
+ logger.Log(3, "User provided public IP service is", publicIpService)
|
|
|
+
|
|
|
+ // prepend the user-specified service so it's checked first
|
|
|
+ iplist = append([]string{publicIpService}, iplist...)
|
|
|
+ }
|
|
|
+
|
|
|
for _, ipserver := range iplist {
|
|
|
+ logger.Log(3, "Running public IP check with service", ipserver)
|
|
|
client := &http.Client{
|
|
|
Timeout: time.Second * 10,
|
|
|
}
|
|
@@ -442,6 +452,7 @@ func GetPublicIP() (string, error) {
|
|
|
continue
|
|
|
}
|
|
|
endpoint = string(bodyBytes)
|
|
|
+ logger.Log(3, "Public IP address is", endpoint)
|
|
|
break
|
|
|
}
|
|
|
}
|