46 breaking releases
| 0.47.0 | Jun 27, 2025 |
|---|---|
| 0.46.0 | Jan 14, 2025 |
| 0.45.0 | Aug 9, 2024 |
| 0.44.1 | May 1, 2024 |
| 0.6.0 | Mar 29, 2019 |
#2262 in Network programming
309,212 downloads per month
Used in 359 crates
(7 directly)
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:
Swarm::close_connectionto close a specific connectionSwarm::disconnect_peer_idto close all connections to a peer
Dependencies
~13–19MB
~249K SLoC