[][src]Crate pea2pea

pea2pea is a P2P library designed with the following use cases in mind:

  • simple and quick creation of custom P2P networks
  • testing/verifying network protocols
  • benchmarking and stress-testing P2P nodes (or other network entities)
  • substituting other, "heavier" nodes in local network tests

Structs

Connection

An object dedicated to performing writes to the stream

ConnectionReader

An object dedicated to performing reads from a connection's stream.

HandshakeHandler

An object dedicated to handling connection handshakes; used in the Handshaking protocol.

InboundHandler

An object dedicated to handling inbound messages; used in the Messaging protocol.

KnownPeers

Contains statistics related to node's connections.

Node

The central object responsible for handling all the connections.

NodeConfig

The node's configuration.

NodeStats

Contains statistics related to the node.

PeerStats

Contains statistics related to a single connection.

Enums

ConnectionSide

Indicates who was the initiator and who was the responder when the connection was established.

Topology

The way in which nodes are connected to each other; used in connect_nodes.

Traits

Handshaking

This protocol can be used to specify and enable network handshakes. Upon establishing a connection, both sides will need to adhere to the specified handshake rules in order to finalize the connection and be able to transmit any messages.

Messaging

This protocol can be used to specify and enable messaging, i.e. handling of inbound messages and replying to them. If handshaking is enabled too, it goes into force only after the handshake has been concluded.

Pea2Pea

A trait for objects containing a Node; it is required to implement protocols.

Functions

connect_nodes

Connects the provided list of nodes in order to form the given Topology.

Type Definitions

HandshakeObjects

A set of objects required to perform handshakes.

MessagingObjects

A set of objects required to handle inbound messages.