43 breaking releases

0.44.0 Nov 5, 2023
0.43.0 Jun 20, 2023
0.42.0 Feb 24, 2023
0.41.0 Nov 25, 2022
0.6.0 Mar 29, 2019

#1842 in Network programming

Download history 46082/week @ 2023-11-02 45083/week @ 2023-11-09 48873/week @ 2023-11-16 50611/week @ 2023-11-23 43527/week @ 2023-11-30 43240/week @ 2023-12-07 39333/week @ 2023-12-14 25969/week @ 2023-12-21 20973/week @ 2023-12-28 35980/week @ 2024-01-04 38799/week @ 2024-01-11 43910/week @ 2024-01-18 40748/week @ 2024-01-25 35270/week @ 2024-02-01 45209/week @ 2024-02-08 39473/week @ 2024-02-15

168,030 downloads per month
Used in 172 crates (8 directly)

MIT license

745KB
14K 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

~7–15MB
~196K SLoC