Moved Android GOOS const to common
This commit is contained in:
parent
1a7414312e
commit
3e53eabe4b
|
@ -0,0 +1,5 @@
|
||||||
|
package common
|
||||||
|
|
||||||
|
const (
|
||||||
|
AndroidPlatform = "android"
|
||||||
|
)
|
|
@ -6,6 +6,7 @@ import (
|
||||||
|
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
|
||||||
|
"github.com/status-im/status-go/common"
|
||||||
"github.com/status-im/status-go/logutils"
|
"github.com/status-im/status-go/logutils"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -14,10 +15,6 @@ var (
|
||||||
Localhost = "Localhost"
|
Localhost = "Localhost"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
AndroidPlatform = "android"
|
|
||||||
)
|
|
||||||
|
|
||||||
func GetOutboundIP() (net.IP, error) {
|
func GetOutboundIP() (net.IP, error) {
|
||||||
conn, err := net.Dial("udp", "255.255.255.255:8080")
|
conn, err := net.Dial("udp", "255.255.255.255:8080")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -92,7 +89,7 @@ func getAndroidLocalIP() ([][]net.IP, error) {
|
||||||
func getLocalAddresses() ([][]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.
|
// TODO until we can resolve Android errors when calling net.Interfaces() just return the outbound local address.
|
||||||
// Sorry Android
|
// Sorry Android
|
||||||
if runtime.GOOS == AndroidPlatform {
|
if runtime.GOOS == common.AndroidPlatform {
|
||||||
return getAndroidLocalIP()
|
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.
|
// that returns a reachable server's address to be used by local pairing client.
|
||||||
func FindReachableAddressesForPairingClient(serverIps []net.IP) ([]net.IP, error) {
|
func FindReachableAddressesForPairingClient(serverIps []net.IP) ([]net.IP, error) {
|
||||||
// TODO until we can resolve Android errors when calling net.Interfaces() just noop. Sorry Android
|
// 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
|
return serverIps, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import (
|
||||||
|
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
|
||||||
|
"github.com/status-im/status-go/common"
|
||||||
"github.com/status-im/status-go/logutils"
|
"github.com/status-im/status-go/logutils"
|
||||||
"github.com/status-im/status-go/server"
|
"github.com/status-im/status-go/server"
|
||||||
"github.com/status-im/status-go/server/pairing/peers"
|
"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 {
|
func (p *PeerNotifier) Search() error {
|
||||||
// TODO until we can resolve Android errors when calling net.Interfaces() just noop. Sorry Android
|
// 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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue