Struct tor_circmgr::CircMgr

source ·
pub struct CircMgr<R: Runtime> { /* private fields */ }
Expand description

A Circuit Manager (CircMgr) manages a set of circuits, returning them when they’re suitable, and launching them if they don’t already exist.

Right now, its notion of “suitable” is quite rudimentary: it just believes in two kinds of circuits: Exit circuits, and directory circuits. Exit circuits are ones that were created to connect to a set of ports; directory circuits were made to talk to directory caches.

This is a “handle”; clones of it share state.

Implementations§

Construct a new circuit manager.

Usage note

For the manager to work properly, you will need to call CircMgr::launch_background_tasks.

Launch the periodic daemon tasks required by the manager to function properly.

Returns a set of TaskHandles that can be used to manage the daemon tasks.

Try to change our configuration settings to new_config.

The actual behavior here will depend on the value of how.

Reload state from the state manager.

We only call this method if we don’t have the lock on the state files. If we have the lock, we only want to save.

Switch from having an unowned persistent state to having an owned one.

Requires that we hold the lock on the state files.

Flush state to the state manager, if there is any unsaved state and we have the lock.

Return true if we saved something; false if we didn’t have the lock.

👎Deprecated: There is no need to call this function if you have used launch_background_tasks

Reconfigure this circuit manager using the latest set of network parameters.

This is deprecated as a public function: launch_background_tasks now ensures that this happens as needed.

Return true if netdir has enough information to be used for this circuit manager.

(This will check whether the netdir is missing any primary guard microdescriptors)

Return a circuit suitable for sending one-hop BEGINDIR streams, launching it if necessary.

Return a circuit suitable for exiting to all of the provided ports, launching it if necessary.

If the list of ports is empty, then the chosen circuit will still end at some exit.

Available on crate feature specific-relay only.

Return a circuit to a specific relay, suitable for using for directory downloads.

This could be used, for example, to download a descriptor for a bridge.

Available on crate feature experimental-api only.

Return a reference to the associated CircuitBuilder that this CircMgr will use to create its circuits.

If circ_id is the unique identifier for a circuit that we’re keeping track of, don’t give it out for any future requests.

Record that a failure occurred on a circuit with a given guard, in a way that makes us unwilling to use that guard for future circuits.

Record that a success occurred on a circuit with a given guard, in a way that makes us possibly willing to use that guard for future circuits.

Return a stream of events about our estimated clock skew; these events are None when we don’t have enough information to make an estimate, and Some(SkewEstimate) otherwise.

Note that this stream can be lossy: if the estimate changes more than one before you read from the stream, you might only get the most recent update.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Executes the destructor for this type. 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
Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait. Read more
Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more
Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more
Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s. Read more
Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait. Read more

Returns the argument unchanged.

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

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
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