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

Function getLocalIPAddress

active_tcp_test.go:23–43  ·  view source on GitHub ↗
(t *testing.T, networkType NetworkType)

Source from the content-addressed store, hash-verified

21)
22
23func getLocalIPAddress(t *testing.T, networkType NetworkType) netip.Addr {
24 t.Helper()
25
26 net, err := stdnet.NewNet()
27 require.NoError(t, err)
28 _, localAddrs, err := localInterfaces(net, problematicNetworkInterfaces, nil, []NetworkType{networkType}, false)
29 require.NoError(t, err)
30 require.NotEmpty(t, localAddrs)
31
32 if networkType.IsIPv6() {
33 for _, addr := range localAddrs {
34 if !addr.addr.IsLinkLocalUnicast() {
35 return addr.addr
36 }
37 }
38
39 t.Skip("no non-link-local IPv6 address available")
40 }
41
42 return localAddrs[0].addr
43}
44
45func ipv6Available(t *testing.T) bool {
46 t.Helper()

Callers 2

TestUDPMuxFunction · 0.85
TestActiveTCPFunction · 0.85

Calls 2

localInterfacesFunction · 0.85
IsIPv6Method · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…