Enum tor_linkspec::ChannelMethod
source · #[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>where
P: Fn(&SocketAddr) -> bool,
pub fn retain_addrs<P>(&mut self, pred: P) -> Result<(), RetainAddrsError>where
P: Fn(&SocketAddr) -> bool,
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 more