//
// 1. A wild-wild listen, "tcp" + ""
// If the platform supports both IPv6 and IPv6 IPv4-mapping
-// capabilities, we assume that the user want to listen on
-// both IPv4 and IPv6 wildcard address over an AF_INET6
-// socket with IPV6_V6ONLY=0. Otherwise we prefer an IPv4
-// wildcard address listen over an AF_INET socket.
+// capabilities, or does not support IPv4, we assume that
+// the user wants to listen on both IPv4 and IPv6 wildcard
+// addresses over an AF_INET6 socket with IPV6_V6ONLY=0.
+// Otherwise we prefer an IPv4 wildcard address listen over
+// an AF_INET socket.
//
// 2. A wild-ipv4wild listen, "tcp" + "0.0.0.0"
// Same as 1.
}
if mode == "listen" && (laddr == nil || laddr.isWildcard()) {
- if supportsIPv4map {
+ if supportsIPv4map || !supportsIPv4 {
return syscall.AF_INET6, false
}
if laddr == nil {
// Test functionality of IPv4 communication using AF_INET6
// sockets.
- if !supportsIPv4map && (network == "tcp" || network == "udp" || network == "ip") && wildcard {
+ if !supportsIPv4map && supportsIPv4 && (network == "tcp" || network == "udp" || network == "ip") && wildcard {
// At this point, we prefer IPv4 when ip is nil.
// See favoriteAddrFamily for further information.
if ip.To16() != nil && ip.To4() == nil && cip.To4() != nil { // a pair of IPv6 server and IPv4 client
for i, tt := range tcpServerTests {
if !testableListenArgs(tt.snet, tt.saddr, tt.taddr) {
- t.Logf("skipping %s test", tt.snet+" "+tt.saddr+"->"+tt.taddr)
+ t.Logf("skipping %s test", tt.snet+" "+tt.saddr+"<-"+tt.taddr)
continue
}
func TestUDPServer(t *testing.T) {
for i, tt := range udpServerTests {
if !testableListenArgs(tt.snet, tt.saddr, tt.taddr) {
- t.Logf("skipping %s test", tt.snet+" "+tt.saddr+"->"+tt.taddr)
+ t.Logf("skipping %s test", tt.snet+" "+tt.saddr+"<-"+tt.taddr)
continue
}
func TestUnixgramServer(t *testing.T) {
for i, tt := range unixgramServerTests {
if !testableListenArgs("unixgram", tt.saddr, "") {
- t.Logf("skipping %s test", "unixgram "+tt.saddr+"->"+tt.caddr)
+ t.Logf("skipping %s test", "unixgram "+tt.saddr+"<-"+tt.caddr)
continue
}