Enum communication::actor::CommunicationRequest [−][src]
pub enum CommunicationRequest<Req, ClientMsg: Message> { RequestMsg { peer_id: PeerId, request: Req, }, SetClientRef(ActorRef<ClientMsg>), AddPeer { peer_id: PeerId, addr: Option<Multiaddr>, is_relay: Option<RelayDirection>, }, GetSwarmInfo, BanPeer(PeerId), UnbanPeer(PeerId), StartListening(Option<Multiaddr>), RemoveListener, ConfigRelay { peer_id: PeerId, direction: RelayDirection, }, RemoveRelay(PeerId), ConfigureFirewall(FirewallRule), Shutdown, }
Requests for the [CommunicationActor
].
Variants
Send a request to a remote peer. This requires that a connection to the targeted peer has been established and is active.
Fields of RequestMsg
peer_id: PeerId
request: Req
SetClientRef(ActorRef<ClientMsg>)
Set the actor reference that incoming request are forwarded to.
Add dialing information for a peer. This will attempt to connect to the peer either by the address or by peer id if it is already known due to e.g. mDNS. If the targeted peer is not a relay, and can not be reached directly, it will be attempted to reach it through a relay, if there are any.
Fields of AddPeer
Get information about the swarm with local peer id, listening addresses and active connections.
BanPeer(PeerId)
Ban a peer, which prevents any communication from / to that peer.
UnbanPeer(PeerId)
Unban a peer to allow future communication.
Start listening to a port on the swarm.
If no Multiaddr
is provided, the address will be OS assigned.
Stop listening locally to the swarm. Without a listener, the local peer can not be directly dialed from remote. Relayed listening addresses will not be removed with this.
Configure to use a peer as relay for dialing, listening, or both.
The peer has to be known, which means that it has to be added with CommunicationRequest::AddPeer
before.
Existing relay configuration for the same peer is overwritten with this.
If the the direction includes listening on the relay.
Fields of ConfigRelay
peer_id: PeerId
direction: RelayDirection
RemoveRelay(PeerId)
Stop using the peer as relay.
ConfigureFirewall(FirewallRule)
Add or remove a rule of the firewall. If a rule for a peer & direction combination already exists, it is overwritten.
Shutdown communication actor.
Trait Implementations
impl<Req: Clone, ClientMsg: Clone + Message> Clone for CommunicationRequest<Req, ClientMsg>
[src]
fn clone(&self) -> CommunicationRequest<Req, ClientMsg>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<Req: Debug, ClientMsg: Debug + Message> Debug for CommunicationRequest<Req, ClientMsg>
[src]
Auto Trait Implementations
impl<Req, ClientMsg> !RefUnwindSafe for CommunicationRequest<Req, ClientMsg>
impl<Req, ClientMsg> Send for CommunicationRequest<Req, ClientMsg> where
Req: Send,
Req: Send,
impl<Req, ClientMsg> Sync for CommunicationRequest<Req, ClientMsg> where
Req: Sync,
Req: Sync,
impl<Req, ClientMsg> Unpin for CommunicationRequest<Req, ClientMsg> where
Req: Unpin,
Req: Unpin,
impl<Req, ClientMsg> !UnwindSafe for CommunicationRequest<Req, ClientMsg>
Blanket Implementations
impl<T> ActorArgs for T where
T: 'static + Clone + Send + Sync,
[src]
T: 'static + Clone + Send + Sync,
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> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Message for T where
T: 'static + Debug + Clone + Send,
[src]
T: 'static + Debug + Clone + Send,
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>,