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

RequestMsg

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: PeerIdrequest: Req
SetClientRef(ActorRef<ClientMsg>)

Set the actor reference that incoming request are forwarded to.

AddPeer

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

peer_id: PeerIdaddr: Option<Multiaddr>is_relay: Option<RelayDirection>
GetSwarmInfo

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.

StartListening(Option<Multiaddr>)

Start listening to a port on the swarm. If no Multiaddr is provided, the address will be OS assigned.

RemoveListener

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.

ConfigRelay

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: PeerIddirection: 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

Shutdown communication actor.

Trait Implementations

impl<Req: Clone, ClientMsg: Clone + Message> Clone for CommunicationRequest<Req, ClientMsg>[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

impl<Req, ClientMsg> Sync for CommunicationRequest<Req, ClientMsg> where
    Req: Sync

impl<Req, ClientMsg> Unpin for CommunicationRequest<Req, ClientMsg> where
    Req: Unpin

impl<Req, ClientMsg> !UnwindSafe for CommunicationRequest<Req, ClientMsg>

Blanket Implementations

impl<T> ActorArgs for T where
    T: 'static + Clone + Send + Sync
[src]

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> From<T> for T[src]

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

impl<T> Message for T where
    T: 'static + Debug + Clone + Send
[src]

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>,