diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index f7056592..6a492eed 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -14,6 +14,7 @@ import ( "math" "math/big" "net" + "net/http" "os" "os/exec" "path/filepath" @@ -134,25 +135,23 @@ func IsContextErr(err error) bool { // GetExternalIPAddress returns external IP address func GetExternalIPAddress() (externalIP string, err error) { - return "localhost", nil - /* - resp, err := http.Get("https://api.ipify.org") - if err != nil { - return "", err - } + resp, err := http.Get("https://api.ipify.org") + if err != nil { + return "", err + } - defer resp.Body.Close() + defer resp.Body.Close() - body, err := io.ReadAll(resp.Body) - if err != nil { - return "", err - } + body, err := io.ReadAll(resp.Body) + if err != nil { + return "", err + } - if net.ParseIP(string(body)) == nil { - return "", errors.Errorf("invalid IP response from %s", "ipconf.ip") - } + if net.ParseIP(string(body)) == nil { + return "", errors.Errorf("invalid IP response from %s", "api.ipify.org") + } - return string(body), nil */ + return string(body), nil } // B64Encode base64 encodes diff --git a/tests/system/config.test-1.yml b/tests/system/config.test-1.yml index ac3cced4..eb214cd4 100644 --- a/tests/system/config.test-1.yml +++ b/tests/system/config.test-1.yml @@ -2,7 +2,7 @@ supernode: key_name: "testkey1" identity: "lumera1em87kgrvgttrkvuamtetyaagjrhnu3vjy44at4" - host: "localhost" + host: "0.0.0.0" port: 4444 gateway_port: 8002 diff --git a/tests/system/config.test-2.yml b/tests/system/config.test-2.yml index 7cb80cf9..1b044a89 100644 --- a/tests/system/config.test-2.yml +++ b/tests/system/config.test-2.yml @@ -3,7 +3,7 @@ supernode: key_name: "testkey2" identity: "lumera1cf0ms9ttgdvz6zwlqfty4tjcawhuaq69p40w0c" - host: "localhost" + host: "0.0.0.0" port: 4446 gateway_port: 8003 diff --git a/tests/system/config.test-3.yml b/tests/system/config.test-3.yml index 55e4e12e..2a259066 100644 --- a/tests/system/config.test-3.yml +++ b/tests/system/config.test-3.yml @@ -3,7 +3,7 @@ supernode: key_name: "testkey3" identity: "lumera1cjyc4ruq739e2lakuhargejjkr0q5vg6x3d7kp" - host: "localhost" + host: "0.0.0.0" port: 4448 gateway_port: 8004