(dst string)
| 54 | var fallbackOwnAddress = netip.MustParseAddr("127.0.0.1") |
| 55 | |
| 56 | func probeRoute(dst string) (src netip.Addr) { |
| 57 | c, err := net.Dial("udp", net.JoinHostPort(dst, "53")) |
| 58 | if err != nil { |
| 59 | return |
| 60 | } |
| 61 | defer c.Close() |
| 62 | a := c.LocalAddr() |
| 63 | if a == nil { |
| 64 | return |
| 65 | } |
| 66 | |
| 67 | if na, ok := a.(interface{ AddrPort() netip.AddrPort }); ok { |
| 68 | return na.AddrPort().Addr() |
| 69 | } |
| 70 | return |
| 71 | } |
| 72 | |
| 73 | func myIPAddress() netip.Addr { |
| 74 | for _, a := range probingAddresses { |
no test coverage detected