|
|
@@ -9,8 +9,8 @@ import (
|
|
|
"runtime"
|
|
|
"testing"
|
|
|
|
|
|
- "golang.org/x/net/internal/nettest"
|
|
|
"golang.org/x/net/ipv6"
|
|
|
+ "golang.org/x/net/nettest"
|
|
|
)
|
|
|
|
|
|
var udpMultipleGroupListenerTests = []net.Addr{
|
|
|
@@ -24,7 +24,7 @@ func TestUDPSinglePacketConnWithMultipleGroupListeners(t *testing.T) {
|
|
|
case "aix", "fuchsia", "hurd", "js", "nacl", "plan9", "windows":
|
|
|
t.Skipf("not supported on %s", runtime.GOOS)
|
|
|
}
|
|
|
- if !supportsIPv6 {
|
|
|
+ if !nettest.SupportsIPv6() {
|
|
|
t.Skip("ipv6 is not supported")
|
|
|
}
|
|
|
|
|
|
@@ -43,7 +43,7 @@ func TestUDPSinglePacketConnWithMultipleGroupListeners(t *testing.T) {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
for i, ifi := range ift {
|
|
|
- if _, ok := nettest.IsMulticastCapable("ip6", &ifi); !ok {
|
|
|
+ if _, err := nettest.MulticastSource("ip6", &ifi); err != nil {
|
|
|
continue
|
|
|
}
|
|
|
if err := p.JoinGroup(&ifi, gaddr); err != nil {
|
|
|
@@ -64,7 +64,7 @@ func TestUDPMultiplePacketConnWithMultipleGroupListeners(t *testing.T) {
|
|
|
case "aix", "fuchsia", "hurd", "js", "nacl", "plan9", "windows":
|
|
|
t.Skipf("not supported on %s", runtime.GOOS)
|
|
|
}
|
|
|
- if !supportsIPv6 {
|
|
|
+ if !nettest.SupportsIPv6() {
|
|
|
t.Skip("ipv6 is not supported")
|
|
|
}
|
|
|
|
|
|
@@ -94,7 +94,7 @@ func TestUDPMultiplePacketConnWithMultipleGroupListeners(t *testing.T) {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
for i, ifi := range ift {
|
|
|
- if _, ok := nettest.IsMulticastCapable("ip6", &ifi); !ok {
|
|
|
+ if _, err := nettest.MulticastSource("ip6", &ifi); err != nil {
|
|
|
continue
|
|
|
}
|
|
|
for _, p := range ps {
|
|
|
@@ -119,7 +119,7 @@ func TestUDPPerInterfaceSinglePacketConnWithSingleGroupListener(t *testing.T) {
|
|
|
case "aix", "fuchsia", "hurd", "js", "nacl", "plan9", "windows":
|
|
|
t.Skipf("not supported on %s", runtime.GOOS)
|
|
|
}
|
|
|
- if !supportsIPv6 {
|
|
|
+ if !nettest.SupportsIPv6() {
|
|
|
t.Skip("ipv6 is not supported")
|
|
|
}
|
|
|
|
|
|
@@ -136,8 +136,8 @@ func TestUDPPerInterfaceSinglePacketConnWithSingleGroupListener(t *testing.T) {
|
|
|
}
|
|
|
port := "0"
|
|
|
for i, ifi := range ift {
|
|
|
- ip, ok := nettest.IsMulticastCapable("ip6", &ifi)
|
|
|
- if !ok {
|
|
|
+ ip, err := nettest.MulticastSource("ip6", &ifi)
|
|
|
+ if err != nil {
|
|
|
continue
|
|
|
}
|
|
|
c, err := net.ListenPacket("udp6", net.JoinHostPort(ip.String()+"%"+ifi.Name, port)) // unicast address with non-reusable port
|
|
|
@@ -175,11 +175,11 @@ func TestIPSinglePacketConnWithSingleGroupListener(t *testing.T) {
|
|
|
case "aix", "fuchsia", "hurd", "js", "nacl", "plan9", "windows":
|
|
|
t.Skipf("not supported on %s", runtime.GOOS)
|
|
|
}
|
|
|
- if !supportsIPv6 {
|
|
|
+ if !nettest.SupportsIPv6() {
|
|
|
t.Skip("ipv6 is not supported")
|
|
|
}
|
|
|
- if m, ok := nettest.SupportsRawIPSocket(); !ok {
|
|
|
- t.Skip(m)
|
|
|
+ if !nettest.SupportsRawSocket() {
|
|
|
+ t.Skipf("not supported on %s/%s", runtime.GOOS, runtime.GOARCH)
|
|
|
}
|
|
|
|
|
|
c, err := net.ListenPacket("ip6:ipv6-icmp", "::") // wildcard address
|
|
|
@@ -197,7 +197,7 @@ func TestIPSinglePacketConnWithSingleGroupListener(t *testing.T) {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
for i, ifi := range ift {
|
|
|
- if _, ok := nettest.IsMulticastCapable("ip6", &ifi); !ok {
|
|
|
+ if _, err := nettest.MulticastSource("ip6", &ifi); err != nil {
|
|
|
continue
|
|
|
}
|
|
|
if err := p.JoinGroup(&ifi, &gaddr); err != nil {
|
|
|
@@ -219,11 +219,11 @@ func TestIPPerInterfaceSinglePacketConnWithSingleGroupListener(t *testing.T) {
|
|
|
case "aix", "fuchsia", "hurd", "js", "nacl", "plan9", "windows":
|
|
|
t.Skipf("not supported on %s", runtime.GOOS)
|
|
|
}
|
|
|
- if !supportsIPv6 {
|
|
|
+ if !nettest.SupportsIPv6() {
|
|
|
t.Skip("ipv6 is not supported")
|
|
|
}
|
|
|
- if m, ok := nettest.SupportsRawIPSocket(); !ok {
|
|
|
- t.Skip(m)
|
|
|
+ if !nettest.SupportsRawSocket() {
|
|
|
+ t.Skipf("not supported on %s/%s", runtime.GOOS, runtime.GOARCH)
|
|
|
}
|
|
|
|
|
|
gaddr := net.IPAddr{IP: net.ParseIP("ff02::114")} // see RFC 4727
|
|
|
@@ -238,8 +238,8 @@ func TestIPPerInterfaceSinglePacketConnWithSingleGroupListener(t *testing.T) {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
for i, ifi := range ift {
|
|
|
- ip, ok := nettest.IsMulticastCapable("ip6", &ifi)
|
|
|
- if !ok {
|
|
|
+ ip, err := nettest.MulticastSource("ip6", &ifi)
|
|
|
+ if err != nil {
|
|
|
continue
|
|
|
}
|
|
|
c, err := net.ListenPacket("ip6:ipv6-icmp", ip.String()+"%"+ifi.Name) // unicast address
|