Struct tor_linkspec::PtTarget
source · 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