mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
net: prefer an IPv4 listen if no address given
This CL avoids net.Listen("tcp", ":80"), http.ListenAdnServe(":80")
prefer an IPv6 listen.
R=rsc
CC=golang-dev
https://golang.org/cl/5669043
This commit is contained in:
parent
60e4d5668e
commit
6fbe80572e
3 changed files with 11 additions and 11 deletions
|
|
@ -115,16 +115,13 @@ func doTest(t *testing.T, network, listenaddr, dialaddr string) {
|
|||
}
|
||||
|
||||
func TestTCPServer(t *testing.T) {
|
||||
if runtime.GOOS != "openbsd" {
|
||||
doTest(t, "tcp", "", "127.0.0.1")
|
||||
}
|
||||
doTest(t, "tcp", "", "127.0.0.1")
|
||||
doTest(t, "tcp", "0.0.0.0", "127.0.0.1")
|
||||
doTest(t, "tcp", "127.0.0.1", "127.0.0.1")
|
||||
doTest(t, "tcp4", "", "127.0.0.1")
|
||||
doTest(t, "tcp4", "0.0.0.0", "127.0.0.1")
|
||||
doTest(t, "tcp4", "127.0.0.1", "127.0.0.1")
|
||||
if supportsIPv6 {
|
||||
doTest(t, "tcp", "", "[::1]")
|
||||
doTest(t, "tcp", "[::]", "[::1]")
|
||||
doTest(t, "tcp", "[::1]", "[::1]")
|
||||
doTest(t, "tcp6", "", "[::1]")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue