Expand description
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. When used with a Swarm
,
it will respond to inbound ping requests and as necessary periodically send outbound
ping requests on every established connection. If a configurable number of consecutive
pings fail, the connection will be closed.
The Behaviour
network behaviour produces Event
s, which may be consumed from the Swarm
by an application, e.g. to collect statistics.
Note: The ping protocol does not keep otherwise idle connections alive by default, see
Config::with_keep_alive
for changing this behaviour.
Structs
- A
NetworkBehaviour
that responds to inbound pings and periodically sends outbound pings on every established connection. - The configuration for outbound pings.
- Event generated by the
Ping
network behaviour.
Enums
- An outbound ping failure.
- The successful result of processing an inbound or outbound ping.
Constants
Type Definitions
- PingDeprecated
- PingConfigDeprecated
- PingEventDeprecated
- PingFailureDeprecated
- PingResultDeprecated
- PingSuccessDeprecated
- The result of an inbound or outbound ping.