Trait tor_guardmgr::bridge::descs::BridgeDescProvider

source ·
pub trait BridgeDescProvider: DynClone + Send + Sync {
    // Required methods
    fn bridges(&self) -> Arc<BridgeDescList>;
    fn events(&self) -> BoxStream<'static, BridgeDescEvent>;
    fn set_bridges(&self, bridges: &[BridgeConfig]);
}
Available on crate feature bridge-client only.
Expand description

Trait for an object that knows how to fetch bridge descriptors as needed.

A “bridge descriptor” (represented by BridgeDesc) is a self-signed representation of a bridge’s keys, capabilities, and other information. We can connect to a bridge without a descriptor, but we need to have one before we can build a multi-hop circuit through a bridge.

In arti, the implementor of this trait is BridgeDescMgr. We define this trait here so that we can avoid a circularity in our crate dependencies. (Since BridgeDescMgr uses circuits, it needs CircMgr, which needs GuardMgr, which in turn needs BridgeDescMgr again. We break this circularity by having GuardMgr use BridgeDescMgr only through this trait’s API.)

Required Methods§

source

fn bridges(&self) -> Arc<BridgeDescList>

Return the current set of bridge descriptors.

source

fn events(&self) -> BoxStream<'static, BridgeDescEvent>

Return a stream that gets a notification when the set of bridge descriptors has changed.

source

fn set_bridges(&self, bridges: &[BridgeConfig])

Change the set of bridges that we want to download descriptors for.

Bridges outside of this set will not have their descriptors updated, and will not be revealed in the BridgeDescList.

Implementors§