pub struct PtTarget { /* private fields */ }
Expand description
The set of information passed to the pluggable transport subsystem in order to establish a connection to a bridge relay.
Implementations§
Source§impl PtTarget
impl PtTarget
Sourcepub fn new(transport: PtTransportName, addr: PtTargetAddr) -> Self
pub fn new(transport: PtTransportName, addr: PtTargetAddr) -> Self
Create a new PtTarget
(with no settings)
Sourcepub fn push_setting(
&mut self,
k: impl Into<String>,
v: impl Into<String>,
) -> Result<(), PtTargetInvalidSetting>
pub fn push_setting( &mut self, k: impl Into<String>, v: impl Into<String>, ) -> Result<(), PtTargetInvalidSetting>
Add a setting (to be passed during the SOCKS handshake)
Sourcepub fn transport(&self) -> &PtTransportName
pub fn transport(&self) -> &PtTransportName
Get the transport name
Sourcepub fn addr(&self) -> &PtTargetAddr
pub fn addr(&self) -> &PtTargetAddr
Get the transport target address (or host and port)
Sourcepub fn settings(&self) -> impl Iterator<Item = (&str, &str)>
pub fn settings(&self) -> impl Iterator<Item = (&str, &str)>
Iterate over the PT setting strings
Sourcepub fn socket_addrs(&self) -> Option<&[SocketAddr]>
pub fn socket_addrs(&self) -> Option<&[SocketAddr]>
Return all the advertized socket addresses to which this target 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! The address will be interpreted by the implementation of this pluggable transport.
Sourcepub fn into_parts(self) -> (PtTransportName, PtTargetAddr, PtTargetSettings)
pub fn into_parts(self) -> (PtTransportName, PtTargetAddr, PtTargetSettings)
Consume the PtTarget
and return the component parts
Trait Implementations§
Source§impl<'de> Deserialize<'de> for PtTarget
impl<'de> Deserialize<'de> for PtTarget
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for PtTarget
impl StructuralPartialEq for PtTarget
Auto Trait Implementations§
impl Freeze for PtTarget
impl RefUnwindSafe for PtTarget
impl Send for PtTarget
impl Sync for PtTarget
impl Unpin for PtTarget
impl UnwindSafe for PtTarget
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
Mutably borrows from an owned value. Read more
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
Checks if this value is equivalent to the given key. Read more
§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
Compare self to
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>
Converts
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>
Converts
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