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 a process-unique identifier for this channel.

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The type of value produced by the sink when an error occurs.

Attempts to prepare the Sink to receive a value. Read more

Begin the process of sending a value to the sink. Each call to this function must be preceded by a successful call to poll_ready which returned Poll::Ready(Ok(())). Read more

Flush any remaining output from this sink. Read more

Flush any remaining output and close this sink, if necessary. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Should always be Self

Composes a function in front of the sink. Read more

Composes a function in front of the sink. Read more

Transforms the error returned by the sink.

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

Close the sink.

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

Wrap this sink in an Either sink, making it the left-hand variant of that Either. Read more

Wrap this stream in an Either stream, making it the right-hand variant of that Either. Read more

A convenience method for calling [Sink::poll_ready] on Unpin sink types. Read more

A convenience method for calling [Sink::start_send] on Unpin sink types. Read more

A convenience method for calling [Sink::poll_flush] on Unpin sink types. Read more

A convenience method for calling [Sink::poll_close] on Unpin sink types. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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