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

Function testMulticastSocketOptions

ipv6/multicastsockopt_test.go:75–113  ·  view source on GitHub ↗
(t *testing.T, c testIPv6MulticastConn, ifi *net.Interface, grp net.Addr)

Source from the content-addressed store, hash-verified

73}
74
75func testMulticastSocketOptions(t *testing.T, c testIPv6MulticastConn, ifi *net.Interface, grp net.Addr) {
76 t.Helper()
77
78 const hoplim = 255
79 if err := c.SetMulticastHopLimit(hoplim); err != nil {
80 t.Error(err)
81 return
82 }
83 if v, err := c.MulticastHopLimit(); err != nil {
84 t.Error(err)
85 return
86 } else if v != hoplim {
87 t.Errorf("got %v; want %v", v, hoplim)
88 return
89 }
90
91 for _, toggle := range []bool{true, false} {
92 if err := c.SetMulticastLoopback(toggle); err != nil {
93 t.Error(err)
94 return
95 }
96 if v, err := c.MulticastLoopback(); err != nil {
97 t.Error(err)
98 return
99 } else if v != toggle {
100 t.Errorf("got %v; want %v", v, toggle)
101 return
102 }
103 }
104
105 if err := c.JoinGroup(ifi, grp); err != nil {
106 t.Error(err)
107 return
108 }
109 if err := c.LeaveGroup(ifi, grp); err != nil {
110 t.Error(err)
111 return
112 }
113}
114
115func testSourceSpecificMulticastSocketOptions(t *testing.T, c testIPv6MulticastConn, ifi *net.Interface, grp, src net.Addr) {
116 t.Helper()

Callers 1

Calls 8

SetMulticastHopLimitMethod · 0.65
MulticastHopLimitMethod · 0.65
ErrorfMethod · 0.65
SetMulticastLoopbackMethod · 0.65
MulticastLoopbackMethod · 0.65
JoinGroupMethod · 0.65
LeaveGroupMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…