pub struct Endpoint { /* private fields */ }Expand description
Tx5 endpoint.
Implementations§
Source§impl Endpoint
impl Endpoint
Sourcepub fn new(config: Arc<Config>) -> (Self, EndpointRecv)
pub fn new(config: Arc<Config>) -> (Self, EndpointRecv)
Construct a new tx5 endpoint.
Sourcepub async fn listen(&self, sig_url: SigUrl) -> Option<PeerUrl>
pub async fn listen(&self, sig_url: SigUrl) -> Option<PeerUrl>
Connect to a signal server as a listener, allowing incoming connections. You probably only want to call this once.
Sourcepub fn close(&self, peer_url: &PeerUrl)
pub fn close(&self, peer_url: &PeerUrl)
Request that the peer connection identified by the given peer_url
is closed.
Sourcepub async fn send(&self, peer_url: PeerUrl, data: Vec<u8>) -> Result<()>
pub async fn send(&self, peer_url: PeerUrl, data: Vec<u8>) -> Result<()>
Send data to a remote on this tx5 endpoint. The future returned from this method will resolve when the data is handed off to our networking backend.
Sourcepub async fn broadcast(&self, data: &[u8])
pub async fn broadcast(&self, data: &[u8])
Broadcast data to all connections that happen to be open. If no connections are open, no data will be broadcast. The future returned from this method will resolve when all broadcast messages have been handed off to our networking backend (or have timed out).
Sourcepub fn get_listening_addresses(&self) -> Vec<PeerUrl>
pub fn get_listening_addresses(&self) -> Vec<PeerUrl>
Get a list of listening addresses (PeerUrls) at which this endpoint is currently reachable.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Endpoint
impl !RefUnwindSafe for Endpoint
impl Send for Endpoint
impl Sync for Endpoint
impl Unpin for Endpoint
impl !UnwindSafe for Endpoint
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more