MCPcopy
hub / github.com/golang/net / TestConnUnicastSocketOptions

Function TestConnUnicastSocketOptions

ipv6/unicastsockopt_test.go:17–53  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

15)
16
17func TestConnUnicastSocketOptions(t *testing.T) {
18 switch runtime.GOOS {
19 case "fuchsia", "hurd", "js", "nacl", "plan9", "wasip1", "windows":
20 t.Skipf("not supported on %s", runtime.GOOS)
21 }
22 if _, err := nettest.RoutedInterface("ip6", net.FlagUp|net.FlagLoopback); err != nil {
23 t.Skip("ipv6 is not enabled for loopback interface")
24 }
25
26 ln, err := net.Listen("tcp6", "[::1]:0")
27 if err != nil {
28 t.Fatal(err)
29 }
30 defer ln.Close()
31
32 errc := make(chan error, 1)
33 go func() {
34 c, err := ln.Accept()
35 if err != nil {
36 errc <- err
37 return
38 }
39 errc <- c.Close()
40 }()
41
42 c, err := net.Dial("tcp6", ln.Addr().String())
43 if err != nil {
44 t.Fatal(err)
45 }
46 defer c.Close()
47
48 testUnicastSocketOptions(t, ipv6.NewConn(c))
49
50 if err := <-errc; err != nil {
51 t.Errorf("server: %v", err)
52 }
53}
54
55var packetConnUnicastSocketOptionTests = []struct {
56 net, proto, addr string

Callers

nothing calls this directly

Calls 10

RoutedInterfaceFunction · 0.92
NewConnFunction · 0.92
SkipMethod · 0.80
testUnicastSocketOptionsFunction · 0.70
CloseMethod · 0.65
DialMethod · 0.65
StringMethod · 0.65
AddrMethod · 0.65
ErrorfMethod · 0.65
AcceptMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…