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

Function parseAddrFromIface

addr.go:25–36  ·  view source on GitHub ↗

parseAddrFromIface should only be used when it's known the address belongs to that interface. e.g. it's LocalAddress on a listener.

(in net.Addr, ifcName string)

Source from the content-addressed store, hash-verified

23// parseAddrFromIface should only be used when it's known the address belongs to that interface.
24// e.g. it's LocalAddress on a listener.
25func parseAddrFromIface(in net.Addr, ifcName string) (netip.Addr, int, NetworkType, error) {
26 addr, port, nt, err := parseAddr(in)
27 if err != nil {
28 return netip.Addr{}, 0, 0, err
29 }
30 if _, ok := in.(*net.IPNet); ok {
31 // net.IPNet does not have a Zone but we provide it from the interface
32 addr = addrWithOptionalZone(addr, ifcName)
33 }
34
35 return addr, port, nt, nil
36}
37
38func parseAddr(in net.Addr) (netip.Addr, int, NetworkType, error) {
39 host := func(ip net.IP, zone string) (netip.Addr, int, NetworkType, error) {

Callers 2

localInterfacesFunction · 0.85

Calls 2

parseAddrFunction · 0.85
addrWithOptionalZoneFunction · 0.85

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…