// Add a address for dialing the target via the given relay.
// Optionally stop using other relays as fallback.
Add a address for dialing the target via the given relay.
Optionally stop using other relays as fallback.
Add a address for dialing the target via the given relay . Optionally stop using other relays as fallback .
pub fn use_relay(&mut self, target: PeerId, relay: PeerId, is_exclusive: bool) -> Option<Multiaddr> {
        let relayed_addr = self
            .get_relay_addr(&relay)
            .map(|a| assemble_relayed_addr(target, relay, a))?;
        let addrs = self.peers.entry(target).or_default();
        addrs.known.push_front(relayed_addr.clone());
        if is_exclusive {
            addrs.use_relay_fallback = false;
        }
        Some(relayed_addr)
    }
pub fn use_relay ( & mut self , target : PeerId , relay : PeerId , is_exclusive : bool ) -> Option < Multiaddr > { let relayed_addr = self . get_relay_addr ( & relay ) . map ( | a | assemble_relayed_addr ( target , relay , a ) ) ? ; let addrs = self . peers . entry ( target ) . or_default ( ) ; addrs . known . push_front ( relayed_addr . clone ( ) ) ; if is_exclusive { addrs . use_relay_fallback = false ; } Some ( relayed_addr ) }
Add a address for dialing the target via the given relay.
Add a address for dialing the target via the given relay .
&mut self
target
PeerId
relay
PeerId
is_exclusive
bool