Trait P2pServiceWebrtc
pub trait P2pServiceWebrtc: Service {
type Event: From<P2pEvent> + Send + Sync + 'static;
Show 17 methods
// Required methods
fn random_pick(
&mut self,
list: &[P2pConnectionOutgoingInitOpts],
) -> Option<P2pConnectionOutgoingInitOpts>;
fn event_sender(&self) -> &UnboundedSender<Self::Event>;
fn cmd_sender(&self) -> &UnboundedSender<Tracked<Cmd>>;
fn peers(&mut self) -> &mut BTreeMap<PeerId, PeerState>;
fn encrypt<T>(
&mut self,
other_pk: &PublicKey,
message: &T,
) -> Result<<T as EncryptableType>::Encrypted, Box<dyn Error>>
where T: EncryptableType;
fn decrypt<T>(
&mut self,
other_pub_key: &PublicKey,
encrypted: &<T as EncryptableType>::Encrypted,
) -> Result<T, Box<dyn Error>>
where T: EncryptableType;
fn auth_encrypt_and_send(
&mut self,
peer_id: PeerId,
other_pub_key: &PublicKey,
auth: ConnectionAuth,
);
fn auth_decrypt(
&mut self,
other_pub_key: &PublicKey,
auth: ConnectionAuthEncrypted,
) -> Option<ConnectionAuth>;
// Provided methods
fn init<S>(
secret_key: SecretKey,
spawner: S,
rng_seed: [u8; 32],
) -> P2pServiceCtx
where S: TaskSpawner { ... }
fn outgoing_init(&mut self, peer_id: PeerId) { ... }
fn incoming_init(&mut self, peer_id: PeerId, offer: Offer) { ... }
fn set_answer(&mut self, peer_id: PeerId, answer: Answer) { ... }
fn http_signaling_request(&mut self, url: String, offer: Offer) { ... }
fn disconnect(&mut self, peer_id: PeerId) -> bool { ... }
fn channel_open(&mut self, peer_id: PeerId, id: ChannelId) { ... }
fn channel_send(&mut self, peer_id: PeerId, msg_id: MsgId, msg: ChannelMsg) { ... }
fn auth_send(
&mut self,
peer_id: PeerId,
_other_pub_key: &PublicKey,
auth: Option<ConnectionAuthEncrypted>,
) { ... }
}
Required Associated Types§
Required Methods§
fn random_pick( &mut self, list: &[P2pConnectionOutgoingInitOpts], ) -> Option<P2pConnectionOutgoingInitOpts>
fn event_sender(&self) -> &UnboundedSender<Self::Event>
fn cmd_sender(&self) -> &UnboundedSender<Tracked<Cmd>>
fn peers(&mut self) -> &mut BTreeMap<PeerId, PeerState>
fn encrypt<T>(
&mut self,
other_pk: &PublicKey,
message: &T,
) -> Result<<T as EncryptableType>::Encrypted, Box<dyn Error>>where
T: EncryptableType,
fn decrypt<T>(
&mut self,
other_pub_key: &PublicKey,
encrypted: &<T as EncryptableType>::Encrypted,
) -> Result<T, Box<dyn Error>>where
T: EncryptableType,
fn auth_encrypt_and_send( &mut self, peer_id: PeerId, other_pub_key: &PublicKey, auth: ConnectionAuth, )
fn auth_decrypt( &mut self, other_pub_key: &PublicKey, auth: ConnectionAuthEncrypted, ) -> Option<ConnectionAuth>
Provided Methods§
fn init<S>(
secret_key: SecretKey,
spawner: S,
rng_seed: [u8; 32],
) -> P2pServiceCtxwhere
S: TaskSpawner,
fn outgoing_init(&mut self, peer_id: PeerId)
fn incoming_init(&mut self, peer_id: PeerId, offer: Offer)
fn set_answer(&mut self, peer_id: PeerId, answer: Answer)
fn http_signaling_request(&mut self, url: String, offer: Offer)
fn disconnect(&mut self, peer_id: PeerId) -> bool
fn channel_open(&mut self, peer_id: PeerId, id: ChannelId)
fn channel_send(&mut self, peer_id: PeerId, msg_id: MsgId, msg: ChannelMsg)
fn auth_send( &mut self, peer_id: PeerId, _other_pub_key: &PublicKey, auth: Option<ConnectionAuthEncrypted>, )
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.