MCPcopy Create free account
hub / github.com/pion/ice / TestLocalInterfaces_SkipInterfaceDown

Function TestLocalInterfaces_SkipInterfaceDown

net_test.go:113–141  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

111}
112
113func TestLocalInterfaces_SkipInterfaceDown(t *testing.T) {
114 base, err := stdnet.NewNet()
115 require.NoError(t, err)
116
117 sysIfaces, err := base.Interfaces()
118 require.NoError(t, err)
119 if len(sysIfaces) == 0 {
120 t.Skip("no system network interfaces available")
121 }
122
123 clone := *sysIfaces[0]
124 clone.Flags &^= net.FlagUp
125
126 wrapped := &fixedInterfacesNet{
127 Net: base,
128 list: []*transport.Interface{&clone},
129 }
130
131 ifcs, addrs, ierr := localInterfaces(
132 wrapped,
133 nil,
134 nil,
135 nil,
136 false,
137 )
138 require.NoError(t, ierr)
139 require.Len(t, ifcs, 0, "down interfaces must be skipped")
140 require.Len(t, addrs, 0, "no addresses should be collected from a down interface")
141}
142
143func TestLocalInterfaces_SkipLoopbackAddrs_WhenIncludeLoopbackFalse(t *testing.T) {
144 base, err := stdnet.NewNet()

Callers

nothing calls this directly

Calls 2

localInterfacesFunction · 0.85
InterfacesMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…