Struct tari_comms_dht::outbound::SendMessageParams [−][src]
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]
&mut self,
node_id: NodeId,
excluded_peers: Vec<NodeId>
) -> &mut Self
Use the Closest
broadcast strategy.
Parameters
node_id
- Select the closest known peers to this NodeId
excluded_peers
- vector of NodeId
s to exclude from broadcast.
pub fn closest_connected(
&mut self,
node_id: NodeId,
excluded_peers: Vec<NodeId>
) -> &mut Self
[src]
&mut self,
node_id: NodeId,
excluded_peers: Vec<NodeId>
) -> &mut Self
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]
&mut self,
destination: NodeDestination,
excluded_peers: Vec<NodeId>
) -> &mut Self
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]
&mut self,
message_type: DhtMessageType
) -> &mut Self
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]
fn clone(&self) -> SendMessageParams
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for SendMessageParams
[src]
impl Default for SendMessageParams
[src]
Auto Trait Implementations
impl RefUnwindSafe for SendMessageParams
[src]
impl Send for SendMessageParams
[src]
impl Sync for SendMessageParams
[src]
impl Unpin for SendMessageParams
[src]
impl UnwindSafe for SendMessageParams
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> Cast<U> for T where
U: FromCast<T>,
U: FromCast<T>,
pub fn cast(self) -> U
impl<T> Clear for T where
T: InitializableFromZeroed + ?Sized,
T: InitializableFromZeroed + ?Sized,
pub fn clear(&mut self)
impl<'a, T> DefaultFeatures<'a> for T where
T: 'a + Clone + Send + Sync,
T: 'a + Clone + Send + Sync,
pub fn clone_boxed(&self) -> Box<dyn DefaultFeatures<'a> + 'a, Global>
pub fn self_address_mut(&mut self) -> *mut ()
impl<T> From<T> for T
[src]
impl<T> FromBits<T> for T
pub fn from_bits(t: T) -> T
impl<T> FromCast<T> for T
pub fn from_cast(t: T) -> T
impl<T> InitializableFromZeroed for T where
T: Default,
T: Default,
pub unsafe fn initialize(place: *mut T)
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> IntoBits<U> for T where
U: FromBits<T>,
U: FromBits<T>,
pub fn into_bits(self) -> U
impl<T> IntoSql for T
[src]
pub fn into_sql<T>(self) -> Self::Expression where
Self: AsExpression<T>,
[src]
Self: AsExpression<T>,
pub fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression where
&'a Self: AsExpression<T>,
[src]
&'a Self: AsExpression<T>,
impl<'a, T> NonSyncFeatures<'a> for T where
T: 'a + Clone,
T: 'a + Clone,
pub fn clone_boxed(&self) -> Box<dyn NonSyncFeatures<'a> + 'a, Global>
pub fn self_address_mut(&mut self) -> *mut ()
impl<T> SafeBorrow<T> for T where
T: ?Sized,
T: ?Sized,
pub fn borrow_replacement(ptr: &T) -> &T
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,