44 breaking releases

0.45.0 Aug 9, 2024
0.44.1 May 1, 2024
0.44.0 Nov 5, 2023
0.43.0 Jun 20, 2023
0.6.0 Mar 29, 2019

#2126 in Network programming

Download history 52986/week @ 2024-07-17 51764/week @ 2024-07-24 41250/week @ 2024-07-31 63570/week @ 2024-08-07 56699/week @ 2024-08-14 52141/week @ 2024-08-21 63328/week @ 2024-08-28 64644/week @ 2024-09-04 57590/week @ 2024-09-11 59469/week @ 2024-09-18 57620/week @ 2024-09-25 63413/week @ 2024-10-02 58021/week @ 2024-10-09 60440/week @ 2024-10-16 57111/week @ 2024-10-23 43419/week @ 2024-10-30

229,195 downloads per month
Used in 200 crates (9 directly)

MIT license

760KB
15K SLoC

This module implements the /ipfs/ping/1.0.0 protocol.

The ping protocol can be used as a simple application-layer health check for connections of any Transport as well as to measure and record round-trip times.

Usage

The Behaviour struct implements the NetworkBehaviour trait. It will respond to inbound ping requests and periodically send outbound ping requests on every established connection.

It is up to the user to implement a health-check / connection management policy based on the ping protocol.

For example:

  • Disconnect from peers with an RTT > 200ms
  • Disconnect from peers which don't support the ping protocol
  • Disconnect from peers upon the first ping failure

Users should inspect emitted Events and call APIs on Swarm:

Dependencies

~8–15MB
~180K SLoC