Ping sends a ping to the Wireguard engine. The bool returned is true if the ping was performed P2P.
(ctx context.Context, ip netip.Addr)
| 567 | // Ping sends a ping to the Wireguard engine. |
| 568 | // The bool returned is true if the ping was performed P2P. |
| 569 | func (c *Conn) Ping(ctx context.Context, ip netip.Addr) (time.Duration, bool, *ipnstate.PingResult, error) { |
| 570 | dur, p2p, pr, err := c.pingWithType(ctx, ip, tailcfg.PingDisco) |
| 571 | if err == nil { |
| 572 | c.sendPingTelemetry(pr) |
| 573 | } |
| 574 | return dur, p2p, pr, err |
| 575 | } |
| 576 | |
| 577 | func (c *Conn) pingWithType(ctx context.Context, ip netip.Addr, pt tailcfg.PingType) (time.Duration, bool, *ipnstate.PingResult, error) { |
| 578 | errCh := make(chan error, 1) |