From 3e53eabe4ba7b3135ffc920ba135075c5e299154 Mon Sep 17 00:00:00 2001 From: Samuel Hawksby-Robinson Date: Tue, 5 Sep 2023 10:04:38 +0100 Subject: [PATCH] Moved Android GOOS const to common --- VERSION | 2 +- common/devices.go | 5 +++++ server/ips.go | 9 +++------ server/pairing/peers.go | 3 ++- 4 files changed, 11 insertions(+), 8 deletions(-) create mode 100644 common/devices.go diff --git a/VERSION b/VERSION index 0e593cdbf..85d9c625e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.166.5 +0.166.6 diff --git a/common/devices.go b/common/devices.go new file mode 100644 index 000000000..d9fedaa3e --- /dev/null +++ b/common/devices.go @@ -0,0 +1,5 @@ +package common + +const ( + AndroidPlatform = "android" +) diff --git a/server/ips.go b/server/ips.go index 44411a9f7..585e5d895 100644 --- a/server/ips.go +++ b/server/ips.go @@ -6,6 +6,7 @@ import ( "go.uber.org/zap" + "github.com/status-im/status-go/common" "github.com/status-im/status-go/logutils" ) @@ -14,10 +15,6 @@ var ( Localhost = "Localhost" ) -const ( - AndroidPlatform = "android" -) - func GetOutboundIP() (net.IP, error) { conn, err := net.Dial("udp", "255.255.255.255:8080") if err != nil { @@ -92,7 +89,7 @@ func getAndroidLocalIP() ([][]net.IP, error) { func getLocalAddresses() ([][]net.IP, error) { // TODO until we can resolve Android errors when calling net.Interfaces() just return the outbound local address. // Sorry Android - if runtime.GOOS == AndroidPlatform { + if runtime.GOOS == common.AndroidPlatform { return getAndroidLocalIP() } @@ -186,7 +183,7 @@ func getAllAvailableNetworks() ([]net.IPNet, error) { // that returns a reachable server's address to be used by local pairing client. func FindReachableAddressesForPairingClient(serverIps []net.IP) ([]net.IP, error) { // TODO until we can resolve Android errors when calling net.Interfaces() just noop. Sorry Android - if runtime.GOOS == AndroidPlatform { + if runtime.GOOS == common.AndroidPlatform { return serverIps, nil } diff --git a/server/pairing/peers.go b/server/pairing/peers.go index b88afe201..2a8cef61e 100644 --- a/server/pairing/peers.go +++ b/server/pairing/peers.go @@ -7,6 +7,7 @@ import ( "go.uber.org/zap" + "github.com/status-im/status-go/common" "github.com/status-im/status-go/logutils" "github.com/status-im/status-go/server" "github.com/status-im/status-go/server/pairing/peers" @@ -44,7 +45,7 @@ func (p *PeerNotifier) handler(hello *peers.LocalPairingPeerHello) { func (p *PeerNotifier) Search() error { // TODO until we can resolve Android errors when calling net.Interfaces() just noop. Sorry Android - if runtime.GOOS == server.AndroidPlatform { + if runtime.GOOS == common.AndroidPlatform { return nil }