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