pub struct Peer { /* private fields */ }
Expand description

Struct representing the Kadcast Network Peer

Implementations

Create a Peer.

  • config - The Config used to create the Peer
  • listener - The NetworkListen impl notified each time a broadcasted message is received from the network

Return the SocketAddr of a set of random active nodes.

  • amount - The max amount of nodes to return

Broadcast a message to the network

Arguments
  • message - Byte array containing the message to be broadcasted
  • height - (Optional) Overrides default Kadcast broadcast height

Note: The function returns just after the message is put on the internal queue system. It does not guarantee the message will be broadcasted

Send a message to a peer in the network

Arguments
  • message - Byte array containing the message to be sent
  • target - Receiver address

Note: The function returns just after the message is put on the internal queue system. It does not guarantee the message will be broadcasted

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more