Struct tari_comms_dht::outbound::SendMessageParams[][src]

pub struct SendMessageParams { /* fields omitted */ }

Configuration for outbound messages.

use tari_comms::types::CommsPublicKey;

// These params represent sending to 5 random peers. The message will be able to be decrypted by
// the peer with the corresponding secret key of `dest_public_key`.
let dest_public_key = CommsPublicKey::default();
let params = SendMessageParams::new()
  .random(5)
  .with_encryption(OutboundEncryption::EncryptFor(Box::new(dest_public_key)))
  .finish();

Implementations

impl SendMessageParams[src]

pub fn new() -> Self[src]

pub fn direct_public_key(&mut self, public_key: CommsPublicKey) -> &mut Self[src]

Set broadcast_strategy to DirectPublicKey

pub fn direct_node_id(&mut self, node_id: NodeId) -> &mut Self[src]

Set broadcast_strategy to DirectNodeId

pub fn closest(
    &mut self,
    node_id: NodeId,
    excluded_peers: Vec<NodeId>
) -> &mut Self
[src]

Use the Closest broadcast strategy.

Parameters

node_id - Select the closest known peers to this NodeId excluded_peers - vector of NodeIds to exclude from broadcast.

pub fn closest_connected(
    &mut self,
    node_id: NodeId,
    excluded_peers: Vec<NodeId>
) -> &mut Self
[src]

Set broadcast_strategy to Closest.excluded_peers are excluded. Only peers that are currently connected will be included.

pub fn broadcast(&mut self, excluded_peers: Vec<NodeId>) -> &mut Self[src]

Set broadcast_strategy to Neighbours. excluded_peers are excluded. Only Peers that have PeerFeatures::MESSAGE_PROPAGATION are included.

pub fn propagate(
    &mut self,
    destination: NodeDestination,
    excluded_peers: Vec<NodeId>
) -> &mut Self
[src]

pub fn flood(&mut self, excluded: Vec<NodeId>) -> &mut Self[src]

Set broadcast_strategy to Flood

pub fn random(&mut self, n: usize) -> &mut Self[src]

Set broadcast_strategy to Random.

pub fn with_destination(&mut self, destination: NodeDestination) -> &mut Self[src]

Set destination field in message header.

pub fn with_encryption(&mut self, encryption: OutboundEncryption) -> &mut Self[src]

Set encryption mode for message.

pub fn with_discovery(&mut self, is_enabled: bool) -> &mut Self[src]

Set to true to enable discovery, otherwise false

pub fn with_dht_message_type(
    &mut self,
    message_type: DhtMessageType
) -> &mut Self
[src]

Set the DHT message type

pub fn add_message_flag(&mut self, flag: DhtMessageFlags) -> &mut Self[src]

Add a DhtMessageFlag to the header

pub fn with_dht_header(&mut self, dht_header: DhtMessageHeader) -> &mut Self[src]

Override the DHtHeader of a message(s) with the given header

pub fn force_origin(&mut self) -> &mut Self[src]

Force the message origin to be included in the message. The origin is usually not included in messages without encryption, however this setting will force the message origin and signature to be included.

pub fn finish(&mut self) -> FinalSendMessageParams[src]

Return the final SendMessageParams

Trait Implementations

impl Clone for SendMessageParams[src]

impl Debug for SendMessageParams[src]

impl Default for SendMessageParams[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> Cast<U> for T where
    U: FromCast<T>, 

impl<T> Clear for T where
    T: InitializableFromZeroed + ?Sized

impl<'a, T> DefaultFeatures<'a> for T where
    T: 'a + Clone + Send + Sync

impl<T> From<T> for T[src]

impl<T> FromBits<T> for T

impl<T> FromCast<T> for T

impl<T> InitializableFromZeroed for T where
    T: Default

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> IntoBits<U> for T where
    U: FromBits<T>, 

impl<T> IntoSql for T[src]

impl<'a, T> NonSyncFeatures<'a> for T where
    T: 'a + Clone

impl<T> SafeBorrow<T> for T where
    T: ?Sized

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,