Struct RelayLink
pub struct RelayLink { /* private fields */ }Expand description
A media relay this node stays attached to.
Cheap to clone. The link stays until detach or the node’s
shutdown. Dropping the handles leaves it in place.
§Examples
use iroh_live_node::{RelayConfig, RelayStatus};
use n0_watcher::Watcher;
let link = node.attach_relay(RelayConfig::iroh(relay))?;
let mut status = link.status();
while status.get() != RelayStatus::Connected {
status.updated().await.ok();
}
link.detach().await;Implementations§
§impl RelayLink
impl RelayLink
pub fn status(&self) -> Direct<RelayStatus>
pub fn status(&self) -> Direct<RelayStatus>
Returns the media relay’s status, as it changes.
pub fn id(&self) -> LinkId
pub fn id(&self) -> LinkId
Returns this link’s id, as ServingLink::id names it.
pub fn tokens(&self) -> Tokens
pub fn tokens(&self) -> Tokens
Returns the tokens the link presents, seeded from RelayConfig::tokens.
Tokens::set replaces them for every later dial,
and a media relay that refused the old ones is dialed again at once. Set new
ones before the old ones expire.
pub async fn detach(&self)
pub async fn detach(&self)
Detaches from the media relay.
Closes the session, stops redialing and withdraws the media relay’s routes. Idempotent. Cancellation safe: the link’s task finishes the close.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for RelayLink
impl !UnwindSafe for RelayLink
impl Freeze for RelayLink
impl Send for RelayLink
impl Sync for RelayLink
impl Unpin for RelayLink
impl UnsafeUnpin for RelayLink
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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