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

Function defaultIfaceIPv4

cmd/snix/engine_windows.go:142–151  ·  view source on GitHub ↗
(remote netip.Addr)

Source from the content-addressed store, hash-verified

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

Callers 1

runEngineFunction · 0.70

Calls 2

StringMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected