Struct libp2p_swarm::dial_opts::DialOpts
source · pub struct DialOpts(_);
Expand description
Options to configure a dial to a known or unknown peer.
Used in Swarm::dial
and
NetworkBehaviourAction::Dial
.
To construct use either of:
-
DialOpts::peer_id
dialing a known peer -
DialOpts::unknown_peer_id
dialing an unknown peer
Implementations§
source§impl DialOpts
impl DialOpts
sourcepub fn peer_id(peer_id: PeerId) -> WithPeerId
pub fn peer_id(peer_id: PeerId) -> WithPeerId
Dial a known peer.
DialOpts::peer_id(PeerId::random())
.condition(PeerCondition::Disconnected)
.addresses(vec!["/ip6/::1/tcp/12345".parse().unwrap()])
.extend_addresses_through_behaviour()
.build();
sourcepub fn unknown_peer_id() -> WithoutPeerId
pub fn unknown_peer_id() -> WithoutPeerId
Dial an unknown peer.
DialOpts::unknown_peer_id()
.address("/ip6/::1/tcp/12345".parse().unwrap())
.build();
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for DialOpts
impl Send for DialOpts
impl Sync for DialOpts
impl Unpin for DialOpts
impl UnwindSafe for DialOpts
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