diff --git a/internal/socket/socket_go1_9_test.go b/internal/socket/socket_go1_9_test.go index 522486a213..c4edd4a8d5 100644 --- a/internal/socket/socket_go1_9_test.go +++ b/internal/socket/socket_go1_9_test.go @@ -145,7 +145,7 @@ func TestUDP(t *testing.T) { } }) switch runtime.GOOS { - case "linux": + case "android", "linux": t.Run("Messages", func(t *testing.T) { data := []byte("HELLO-R-U-THERE") wmbs := bytes.SplitAfter(data, []byte("-")) @@ -233,7 +233,7 @@ func BenchmarkUDP(b *testing.B) { } }) switch runtime.GOOS { - case "linux": + case "android", "linux": wms := make([]socket.Message, M) for i := range wms { wms[i].Buffers = [][]byte{data} diff --git a/internal/socket/sys_posix.go b/internal/socket/sys_posix.go index 9a0dbcfb98..dc130c27eb 100644 --- a/internal/socket/sys_posix.go +++ b/internal/socket/sys_posix.go @@ -34,7 +34,7 @@ func marshalSockaddr(ip net.IP, port int, zone string) []byte { if ip4 := ip.To4(); ip4 != nil { b := make([]byte, sizeofSockaddrInet) switch runtime.GOOS { - case "linux", "solaris", "windows": + case "android", "linux", "solaris", "windows": NativeEndian.PutUint16(b[:2], uint16(sysAF_INET)) default: b[0] = sizeofSockaddrInet @@ -47,7 +47,7 @@ func marshalSockaddr(ip net.IP, port int, zone string) []byte { if ip6 := ip.To16(); ip6 != nil && ip.To4() == nil { b := make([]byte, sizeofSockaddrInet6) switch runtime.GOOS { - case "linux", "solaris", "windows": + case "android", "linux", "solaris", "windows": NativeEndian.PutUint16(b[:2], uint16(sysAF_INET6)) default: b[0] = sizeofSockaddrInet6 @@ -69,7 +69,7 @@ func parseInetAddr(b []byte, network string) (net.Addr, error) { } var af int switch runtime.GOOS { - case "linux", "solaris", "windows": + case "android", "linux", "solaris", "windows": af = int(NativeEndian.Uint16(b[:2])) default: af = int(b[1])