From 85039317a371340f73c0e7a91593739f1568e0b6 Mon Sep 17 00:00:00 2001 From: Matee Ullah Malik Date: Tue, 19 Aug 2025 14:31:49 +0500 Subject: [PATCH 1/2] feat: enable external IP discovery for P2P --- pkg/utils/utils.go | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) 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 From 10f10e245b8a14e6ee001e4a2f4c9bfce5eb51f6 Mon Sep 17 00:00:00 2001 From: Matee Ullah Malik Date: Tue, 19 Aug 2025 15:05:18 +0500 Subject: [PATCH 2/2] fix: update host configuration from localhost to 0.0.0.0 in test config files --- tests/system/config.test-1.yml | 2 +- tests/system/config.test-2.yml | 2 +- tests/system/config.test-3.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) 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