#[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 unique_direct_addr(&self) -> Option<SocketAddr>
pub fn unique_direct_addr(&self) -> Option<SocketAddr>
Return the SocketAddr if this method is ChannelMethod::Direct and there is one and
only one available address.
This is single address requirement is very important as this call is used during the channel handshake on which we need the actual peer address we are connected to and not all the possibilities.
When connecting or accepting, that addres is put in the OwnedChanTarget and so this extracts it.
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§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 UnsafeUnpin for ChannelMethod
impl UnwindSafe for ChannelMethod
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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