#[non_exhaustive]pub enum ChannelMethod {
Direct(Vec<SocketAddr>),
Pluggable(PtTarget),
}
Expand description
The way to approach a single relay in order to open a channel.
For direct connections, this is simply an address. For connections via a pluggable transport, this includes information about the transport, and any address and settings information that transport requires.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Direct(Vec<SocketAddr>)
Connect to the relay directly at one of several addresses.
Pluggable(PtTarget)
pt-client
only.Connect to a bridge relay via a pluggable transport.
Implementations§
Source§impl ChannelMethod
impl ChannelMethod
Sourcepub fn socket_addrs(&self) -> Option<&[SocketAddr]>
pub fn socket_addrs(&self) -> Option<&[SocketAddr]>
Return all the advertized socket addresses to which this method may connect.
Returns Some(&[])
if there is no way to connect to this target, and
None
if this target does not use SocketAddr
to connect
NOTE that these are not necessarily an address to which you can open a
TCP connection! If this ChannelMethod
is using a non-Direct
transport, then this address will be interpreted by that transport’s
implementation.
Sourcepub fn target_addr(&self) -> Option<PtTargetAddr>
pub fn target_addr(&self) -> Option<PtTargetAddr>
Return a BridgeAddr that this ChannelMethod uses.
Sourcepub fn transport_id(&self) -> TransportId
pub fn transport_id(&self) -> TransportId
Return an identifier for the Transport to be used by this ChannelMethod
.
Sourcepub fn retain_addrs<P>(&mut self, pred: P) -> Result<(), RetainAddrsError>
pub fn retain_addrs<P>(&mut self, pred: P) -> Result<(), RetainAddrsError>
Change this ChannelMethod
by removing every socket address that
does not satisfy pred
.
Hostname
and None
addresses are never removed.
Return an error if we have removed every address.
Sourcepub fn contained_by(&self, other: &ChannelMethod) -> bool
pub fn contained_by(&self, other: &ChannelMethod) -> bool
Return true if every method to contact self
is also a method to
contact other
.
Trait Implementations§
Source§impl Clone for ChannelMethod
impl Clone for ChannelMethod
Source§fn clone(&self) -> ChannelMethod
fn clone(&self) -> ChannelMethod
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ChannelMethod
impl Debug for ChannelMethod
Source§impl HasAddrs for ChannelMethod
impl HasAddrs for ChannelMethod
Source§fn addrs(&self) -> &[SocketAddr]
fn addrs(&self) -> &[SocketAddr]
Source§impl Hash for ChannelMethod
impl Hash for ChannelMethod
Source§impl PartialEq for ChannelMethod
impl PartialEq for ChannelMethod
impl Eq for ChannelMethod
impl StructuralPartialEq for ChannelMethod
Auto Trait Implementations§
impl Freeze for ChannelMethod
impl RefUnwindSafe for ChannelMethod
impl Send for ChannelMethod
impl Sync for ChannelMethod
impl Unpin for ChannelMethod
impl UnwindSafe for ChannelMethod
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more