Struct tor_proto::circuit::ClientCirc
source · [−]pub struct ClientCirc { /* private fields */ }
Expand description
A circuit that we have constructed over the Tor network.
This struct is the interface used by the rest of the code, It is fairly cheaply cloneable. None of the public methods need mutable access, since they all actually communicate with the Reactor which contains the primary mutable state, and does the actual work.
Implementations
sourceimpl ClientCirc
impl ClientCirc
sourcepub fn first_hop(&self) -> OwnedChanTarget
pub fn first_hop(&self) -> OwnedChanTarget
Return a description of the first hop of this circuit.
Panics
Panics if there is no first hop. (This should be impossible outside of the tor-proto crate, but within the crate it’s possible to have a circuit with no hops.)
sourcepub fn path(&self) -> Vec<OwnedChanTarget>
pub fn path(&self) -> Vec<OwnedChanTarget>
Return a description of all the hops in this circuit.
sourcepub async fn extend_ntor<Tg>(
&self,
target: &Tg,
params: &CircParameters
) -> Result<()> where
Tg: CircTarget,
pub async fn extend_ntor<Tg>(
&self,
target: &Tg,
params: &CircParameters
) -> Result<()> where
Tg: CircTarget,
Extend the circuit via the ntor handshake to a new target last hop.
sourcepub async fn begin_stream(
&self,
target: &str,
port: u16,
parameters: Option<StreamParameters>
) -> Result<DataStream>
pub async fn begin_stream(
&self,
target: &str,
port: u16,
parameters: Option<StreamParameters>
) -> Result<DataStream>
Start a stream to the given address and port, using a BEGIN cell.
The use of a string for the address is intentional: you should let the remote Tor relay do the hostname lookup for you.
sourcepub async fn begin_dir_stream(&self) -> Result<DataStream>
pub async fn begin_dir_stream(&self) -> Result<DataStream>
Start a new stream to the last relay in the circuit, using a BEGIN_DIR cell.
sourcepub async fn resolve(&self, hostname: &str) -> Result<Vec<IpAddr>>
pub async fn resolve(&self, hostname: &str) -> Result<Vec<IpAddr>>
Perform a DNS lookup, using a RESOLVE cell with the last relay in this circuit.
Note that this function does not check for timeouts; that’s the caller’s responsibility.
sourcepub async fn resolve_ptr(&self, addr: IpAddr) -> Result<Vec<String>>
pub async fn resolve_ptr(&self, addr: IpAddr) -> Result<Vec<String>>
Perform a reverse DNS lookup, by sending a RESOLVE cell with the last relay on this circuit.
Note that this function does not check for timeouts; that’s the caller’s responsibility.
sourcepub fn terminate(&self)
pub fn terminate(&self)
Shut down this circuit, along with all streams that are using it. Happens asynchronously (i.e. the circuit won’t necessarily be done shutting down immediately after this function returns!).
Note that other references to this circuit may exist. If they do, they will stop working after you call this function.
It’s not necessary to call this method if you’re just done with a circuit: the channel should close on its own once nothing is using it any more.
sourcepub fn is_closing(&self) -> bool
pub fn is_closing(&self) -> bool
Return true if this circuit is closed and therefore unusable.
Trait Implementations
sourceimpl Clone for ClientCirc
impl Clone for ClientCirc
sourcefn clone(&self) -> ClientCirc
fn clone(&self) -> ClientCirc
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl !RefUnwindSafe for ClientCirc
impl Send for ClientCirc
impl Sync for ClientCirc
impl Unpin for ClientCirc
impl !UnwindSafe for ClientCirc
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more