pub struct Channel { /* private fields */ }
Expand description
An open client channel, ready to send and receive Tor cells.
A channel is a direct connection to a Tor relay, implemented using TLS.
This struct is a frontend that can be used to send cells (using the Sink<ChanCell>
impl and otherwise control the channel. The main state is in the Reactor object.
Channel
is cheap to clone.
(Users need a mutable reference because of the types in Sink
, and ultimately because
cell_tx: mpsc::Sender
doesn’t work without mut.
Implementations
Return the Ed25519 identity for the peer of this channel.
Return the (legacy) RSA identity for the peer of this channel.
Return an error if this channel is somehow mismatched with the given target.
Return true if this channel is closed and therefore unusable.
Like futures::Sink::poll_ready
.
Transmit a single cell on a channel.
Return a newly allocated PendingClientCirc object with a corresponding circuit reactor. A circuit ID is allocated, but no messages are sent, and no cryptography is done.
To use the results of this method, call Reactor::run() in a new task, then use the methods of crate::circuit::PendingClientCirc to build the circuit.
Shut down this channel immediately, along with all circuits that are using it.
Note that other references to this channel 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 channel: the channel should close on its own once nothing is using it any more.
Tell the reactor that the circuit with the given ID has gone away.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Channel
impl !UnwindSafe for Channel
Blanket Implementations
Mutably borrows from an owned value. Read more
impl<T, Item> SinkExt<Item> for T where
T: Sink<Item> + ?Sized,
impl<T, Item> SinkExt<Item> for T where
T: Sink<Item> + ?Sized,
Composes a function in front of the sink. Read more
fn with_flat_map<U, St, F>(self, f: F) -> WithFlatMap<Self, Item, U, St, F> where
F: FnMut(U) -> St,
St: Stream<Item = Result<Item, Self::Error>>,
fn with_flat_map<U, St, F>(self, f: F) -> WithFlatMap<Self, Item, U, St, F> where
F: FnMut(U) -> St,
St: Stream<Item = Result<Item, Self::Error>>,
Composes a function in front of the sink. Read more
fn sink_map_err<E, F>(self, f: F) -> SinkMapErr<Self, F> where
F: FnOnce(Self::Error) -> E,
fn sink_map_err<E, F>(self, f: F) -> SinkMapErr<Self, F> where
F: FnOnce(Self::Error) -> E,
Transforms the error returned by the sink.
fn sink_err_into<E>(self) -> SinkErrInto<Self, Item, E> where
Self::Error: Into<E>,
fn sink_err_into<E>(self) -> SinkErrInto<Self, Item, E> where
Self::Error: Into<E>,
Map this sink’s error to a different error type using the Into
trait. Read more
Adds a fixed-size buffer to the current sink. Read more
Fanout items to multiple sinks. Read more
Flush the sink, processing all pending items. Read more
A future that completes after the given item has been fully processed into the sink, including flushing. Read more
A future that completes after the given item has been received by the sink. Read more
A future that completes after the given stream has been fully processed into the sink, including flushing. Read more
fn left_sink<Si2>(self) -> Either<Self, Si2> where
Si2: Sink<Item, Error = Self::Error>,
fn left_sink<Si2>(self) -> Either<Self, Si2> where
Si2: Sink<Item, Error = Self::Error>,
Wrap this sink in an Either
sink, making it the left-hand variant
of that Either
. Read more
fn right_sink<Si1>(self) -> Either<Si1, Self> where
Si1: Sink<Item, Error = Self::Error>,
fn right_sink<Si1>(self) -> Either<Si1, Self> where
Si1: Sink<Item, Error = Self::Error>,
Wrap this stream in an Either
stream, making it the right-hand variant
of that Either
. Read more
fn start_send_unpin(&mut self, item: Item) -> Result<(), Self::Error> where
Self: Unpin,
fn start_send_unpin(&mut self, item: Item) -> Result<(), Self::Error> where
Self: Unpin,
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more