MCPcopy Create free account
hub / github.com/SamNet-dev/snix / defaultIfaceIPv4

Function defaultIfaceIPv4

cmd/snix/engine_linux.go:143–152  ·  view source on GitHub ↗
(remote netip.Addr)

Source from the content-addressed store, hash-verified

141}
142
143func defaultIfaceIPv4(remote netip.Addr) (netip.Addr, error) {
144 c, err := net.Dial("udp", net.JoinHostPort(remote.String(), "1"))
145 if err != nil {
146 return netip.Addr{}, err
147 }
148 defer c.Close()
149 la := c.LocalAddr().(*net.UDPAddr)
150 addr, _ := netip.AddrFromSlice(la.IP.To4())
151 return addr, nil
152}

Callers 1

runEngineFunction · 0.70

Calls 2

StringMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected