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

#2116 in Network programming

Download history 48506/week @ 2024-08-19 58770/week @ 2024-08-26 67966/week @ 2024-09-02 59669/week @ 2024-09-09 55849/week @ 2024-09-16 60577/week @ 2024-09-23 62165/week @ 2024-09-30 59056/week @ 2024-10-07 57203/week @ 2024-10-14 61667/week @ 2024-10-21 49838/week @ 2024-10-28 68221/week @ 2024-11-04 55623/week @ 2024-11-11 59135/week @ 2024-11-18 62711/week @ 2024-11-25 57579/week @ 2024-12-02

237,329 downloads per month
Used in 202 crates (8 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
~181K SLoC