(ip netip.Addr, pingType tailcfg.PingType, size int, cb func(*ipnstate.PingResult))
| 1340 | } |
| 1341 | |
| 1342 | func (e *userspaceEngine) Ping(ip netip.Addr, pingType tailcfg.PingType, size int, cb func(*ipnstate.PingResult)) { |
| 1343 | res := &ipnstate.PingResult{IP: ip.String()} |
| 1344 | pip, ok := e.PeerForIP(ip) |
| 1345 | if !ok { |
| 1346 | e.logf("ping(%v): no matching peer", ip) |
| 1347 | res.Err = "no matching peer" |
| 1348 | cb(res) |
| 1349 | return |
| 1350 | } |
| 1351 | if pip.IsSelf { |
| 1352 | res.Err = fmt.Sprintf("%v is local Tailscale IP", ip) |
| 1353 | res.IsLocalIP = true |
| 1354 | cb(res) |
| 1355 | return |
| 1356 | } |
| 1357 | peer := pip.Node |
| 1358 | |
| 1359 | e.logf("ping(%v): sending %v ping to %v %v ...", ip, pingType, peer.Key().ShortString(), peer.ComputedName()) |
| 1360 | switch pingType { |
| 1361 | case "disco": |
| 1362 | e.magicConn.Ping(peer, res, size, cb) |
| 1363 | case "TSMP": |
| 1364 | e.sendTSMPPing(ip, peer, res, cb) |
| 1365 | e.sendTSMPDiscoAdvertisement(ip) |
| 1366 | case "ICMP": |
| 1367 | e.sendICMPEchoRequest(ip, peer, res, cb) |
| 1368 | } |
| 1369 | } |
| 1370 | |
| 1371 | func (e *userspaceEngine) mySelfIPMatchingFamily(dst netip.Addr) (src netip.Addr, err error) { |
| 1372 | var zero netip.Addr |
nothing calls this directly
no test coverage detected